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.


In reply to Module Makefile.PL conditional PREREQ_PM by VinsWorldcom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.