views:

85

answers:

2

I want to install File::Fetch, which is a core module in Perl 5.12, in my Perl 5.8.9. In general, I want to compile and install future-dated modules in my back-dated Perl because I cannot upgrade my Perl.

So I downloaded the module and also its dependencies. It's quite painful following the dependency tree but I'm more concerned about the fact that some of them are core modules. If I install these, my Perl 5.8.9 core will have patches from 5.12.

My question is how I can know whether I can safely install the future-dated modules, especially the core modules. Is there a tutorial for this purpose of testing backwardcompatability in Perl?

EDIT:
My module is dual lifed, but I cannot compile it using cpan. It said my FTPsite.yaml has a bad element. However, I followed the dependencies in the modules' META files, and I could compiled the module. Is this one of the odd bits with cpan? Thank you.

I cannot recreate the issue after I installed all those dependencies manually. But here is the error:

cpan[5]> install File::Fetch
Running install for module 'File::Fetch'
Running make for B/BI/BINGOS/File-Fetch-0.24.tar.gz
CPAN: Digest::SHA loaded ok (v5.48)
CPAN: Time::HiRes loaded ok (v1.9715)
CPAN: YAML loaded ok (v0.72)
Alert: While trying to 'parse' YAML file
 '/Users/martin/.cpan/FTPstats.yml'
with 'YAML' the following error was encountered:
  YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /opt/local/lib/perl5/site_perl/5.8.9/YAML.pm line 36
+8  A: 

If the module is available separately (i.e. "dual-lifed"), as both a standalone distribution and inside core Perl, then the standalone version is safe to install on an earlier Perl, assuming its Makefile allows it. That is, if you can do cpan <Module> and it builds and tests without errors, then you are good.

The only problem is if a module is not dual-lifed, which I opined about in this question -- which is where you are likely S.O.L.

Ether
+5  A: 

If a perl core module is also available separately, that means that it is intended to work on older perls (unless it explicitly requires some version of perl), and if it doesn't, that's a bug.

That said, 5.10 was released almost three years ago, and you are going to start seeing more and more problems using newer modules with older versions of perl.

cpan or cpanplus will handle dependencies for you.

ysth
Well, being dual-lived doesn't mean it's intended to work with older perls. It means that it's development doesn't have to wait for a new perl. These modules might work with older perls, but that isn't the point.
brian d foy
@brian d foy: not solely older perls, no, but it should be thought about just like any other cpan distribution - it should work for any perl version unless it says otherwise
ysth
Thank you all. I didn't know of this assumption/convention. Where can I find more such conventions (about the versions and dependencies of Perl modules, and probably the development coordinations in the Perl community),
Martin