How to detect the version of a installed perl module during portbuild

Paul Schmehl pschmehl_lists at
Wed Jan 4 01:08:38 UTC 2012

--On January 3, 2012 9:52:15 PM +0100 Olli Hauer <ohauer at> wrote:

> Hi,
> I'm searching a solution to detect the version of p5-JSON-RPC during
> build time.
> JSON-RPC-1.01 is *not* backward compatible to 0.96 so I have to apply a
> fix to the port only if JSON-RPC > 0.96 is installed.
>> From
> 1.00_01  2011 Nov 16
>     - If you are using old JSON::RPC code (up to 0.96), DO NOT EXPECT
> ...................................................^^^^^^^^^^^^^^

This returns the installed package:

pkg_info -qa | grep "p5-JSON-RPC" | sort | uniq

so maybe you could do something like?

JSON_VER=`pkg_info -qa | grep "p5-JSON-RPC" | sort | uniq | cut -d'-' -f4`

.if ${JSON_VER} >= 1
  do this
  do this

Paul Schmehl, Senior Infosec Analyst
As if it wasn't already obvious, my opinions
are my own and not those of my employer.
"It is as useless to argue with those who have
renounced the use of reason as to administer
medication to the dead." Thomas Jefferson
"There are some ideas so wrong that only a very
intelligent person could believe in them." George Orwell

More information about the freebsd-ports mailing list