bart has asked for the wisdom of the Perl Monks concerning the following question:

I have written a module which internally changes vastly for different Perl versions, in this case, I have a version of the module for the 5.005_x generation, and a completely different one for 5.6.x. I know I can put the latter module in the subdirectory "site/lib/5.6.1", and only perl 5.6.1 will pick it up there... but what about 5.6.0, 5.6.2, and (who knows) 5.6.3? Do I really have to place copies under each versioned subdirectory, or is there a way to make an installed module available for all the 5.6.x branches, at once? Is, maybe, this what "arch" is for?

That would seem like the way to go for XS modules too, as each generation is binary compatible with other versions of the same generation, but not with other generations.

As for a different approach: suppose I make a distribution that only installs the module for the current perl version, how would I have to construct the Makefile.PL?

p.s. In case you're wondering what could be so different between 5.005 and 5.6.x: it's related to UTF-8 support. 5.005 has none whatsoever, while5.6.x provides a reasonable starting point. Not as good as 5.8.x, though...

  • Comment on Modules that differ for different Perl generations

Replies are listed 'Best First'.
Re: Modules that differ for different Perl generations
by Abigail-II (Bishop) on Mar 25, 2004 at 13:36 UTC
    That would seem like the way to go for XS modules too, as each generation is binary compatible with other versions of the same generation, but not with other generations.
    As a basic rule, perl 5.x.y will know it's supposed to be binary compatable with 5.x.z, z < y, and will hence include the appropriate directories in @INC, if available at compile time. At least, 5.8.x does so (but I think 5.6.x as well). For instance:
    perl -wle '$, = "\n"; print @INC' /home/abigail/Perl /opt/perl/lib/5.8.3/i686-linux-64int-ld /opt/perl/lib/5.8.3 /opt/perl/lib/site_perl/5.8.3/i686-linux-64int-ld /opt/perl/lib/site_perl/5.8.3 /opt/perl/lib/site_perl/5.8.2/i686-linux-64int-ld /opt/perl/lib/site_perl/5.8.2 /opt/perl/lib/site_perl/5.8.1/i686-linux-64int-ld /opt/perl/lib/site_perl/5.8.1 /opt/perl/lib/site_perl/5.8.0 /opt/perl/lib/site_perl .

    Abigail

      I think it's worth noting the missing
      /opt/perl/lib/site_perl/5.8.0/i686-linux-64int-ld
      directory in there.

      This bit me when moving from perl 5.6.0 to perl 5.6.1 where as in your example perl 5.6.1 was only picking up the site_perl/5.6.0 directory but not the site_perl/5.6.0/i386 one.

      Anyone know if this behaviour is intentional or just a consequence of the way perl happened to be compiled ? (I'm using standard Red Hat RPMs)

        Intentional. Due to hash randomization, 5.8.1 is not binary compatible with 5.8.0.

        Abigail