VinsWorldcom has asked for the wisdom of the Perl Monks concerning the following question:
My module does some IPv4/v6 stuff and since Perl support for that is still 'developing', I've had to do some workarounds for different Perl versions. I think I have the 'use Socket...' commands all right and tests pass on Perl versions 5.12 and 5.14. Now to build the distribution so anyone can use it...
For Perl < 5.014 I need:
Socket Socket6 Socket::GetAddrInfo
While Socket6 has the getaddrinfo subs, they do not return the same structure as the getaddrinfo natively in Socket for Perl >= 5.14. Socket::GetAddrInfo does this, but doesn't provide the inet_ntop function, so I need Socket6. Yadda yadda ...
For Perl >= 5.014 I need:
Socket
I would simply like to say: If you're on Perl < 5.014, then "Socket::GetAddrInfo" is required. My Makefile.PL
use ExtUtils::MakeMaker; my @prereq_pm; if ($] < 5.014) { push @prereq_pm, "Socket::GetAddrInfo"; push @prereq_pm, 0.21; } WriteMakefile( NAME => [... ... omitted for concise ...] PREREQ_PM => { Net::Frame => 1.09, @prereq_pm }, );
This "works"; however, when I 'make dist' the META.yml created is going to have the prerequisites as they are for the system I'm 'make dist'-ing on (say 5.12) - and when a user downloads my module and tries to build on 5.14, the META.yml in the distribution says Socket::GetAddrInfo is required. Of course, the opposite is also true if I build on 5.14 and the user tries to install on 5.12, Socket::GetAddrInfo won't show up as required - but it is.
The META.yml file seems to matter to the CPAN client when doing installs - how can I get it to evaluate required modules based on the version of Perl the module is currently being built / installed on? I'm thinking dynamically at build / install time versus at 'packing-the-distribution-tarball-gzip' time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Module Makefile.PL conditional PREREQ_PM
by bingos (Vicar) on Feb 02, 2012 at 20:49 UTC | |
by DrHyde (Prior) on Feb 03, 2012 at 11:14 UTC | |
|
Re: Module Makefile.PL conditional PREREQ_PM
by Anonymous Monk on Feb 02, 2012 at 20:36 UTC |