How to detect the version of a installed perl module during
portbuild
Olli Hauer
ohauer at FreeBSD.org
Wed Jan 4 12:00:07 UTC 2012
On 2012-01-03 21:52, Olli Hauer 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 http://cpansearch.perl.org/src/DMAKI/JSON-RPC-1.01/Changes
> 1.00_01 2011 Nov 16
> - If you are using old JSON::RPC code (up to 0.96), DO NOT EXPECT
> YOUR CODE TO WORK. THIS VERSION IS BACKWARDS *INCOMPATIBLE*
> ...................................................^^^^^^^^^^^^^^
>
Thanks for all the suggestions ;)
Meanwhile the following solutions was suggested from upstream (will be implemented as patch in the port)
-use base qw(JSON::RPC::Server::CGI);
+BEGIN {
+ eval { require JSON::RPC::Server::CGI; };
+ if ($@) {
+ require JSON::RPC::Legacy::Server::CGI;
+ our @ISA = qw(JSON::RPC::Legacy::Server::CGI);
+ }
+ else {
+ our @ISA = qw(JSON::RPC::Server::CGI);
+ }
+}
--
olli
More information about the freebsd-ports
mailing list