Module Makefile.PL conditional PREREQ_PMby VinsWorldcom (Vicar)
|on Feb 02, 2012 at 20:27 UTC||Need Help??|
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:
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:
I would simply like to say: If you're on Perl < 5.014, then "Socket::GetAddrInfo" is required. My Makefile.PL
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.