in reply to Re^2: How to move 3 years of modules to my new XP box?
in thread How to move 3 years of modules to my new XP box?

Corion is being a little too terse.

Once you've used the CPAN.pm or CPANPLUS.pm system to create an autobundle file on one machine, you can copy it to another machine and use the CPAN or CPANPLUS "install" command on the bundle file and it will automatically install the modules from cpan. This takes awhile, and it's far from painless, but I think it's more likely to work that just trying to copy perl installations from one box to another (remember: some "perl" modules contain C code that needs to be compiled and any architectural changes will screw these up. And aren't you upgrading your perl version? The perl version is in the path to your modules, and I suggest that it's there for a reason).

So what you do is something like this:

perl -MCPANPLUS -e'shell' b
Or alternately:
perl -MCPAN -e'shell' autobundle

Note that when it finishes it will tell you where it wrote the bundle file.

Bundle files are modules that contain only POD, with a CONTENTS section that contains the actual listing of module names, associating module name with version number.

Chromatic's "Perl Hacks", provides a script (Hack #32) to trim modules from a bundle if they are listed in Module::Corelist.

An even worse problem in my opinion is that this system tries to preserve version numbers. You're far more likely (for a development machine, at least) to want the latest version of everything than a precise clone of the original.

You can do that by hacking the bundle file first, and by replacing all the version numbers (the second column) with the string 'undef'.

Then, after copying your hacked bundle file to the target machine, you once again run either the CPAN.pm or CPANPLUS.pm shell and use the "install" command on the bundle.

You must have CPAN/CPANPLUS set up to deal with dependencies automatically, otherwise this is useless.

Even so, it's likely you'll run into snags along the way. You'll have to get very lucky to just let the install chug over night. More likely, you'll find it got stuck on some problem you'll need to solve manually and then re-start.

I suggest that before restarting you make note of the last successfully installed module, and delete the ones that you don't need to look at again from the bundle file.

If any of this sounds fugly, it's because it is. This is a problem waiting to be solved better, if anyone wants to take it on.

Replies are listed 'Best First'.
Re^4: How to move 3 years of modules to my new XP box?
by dmizz (Novice) on Nov 26, 2008 at 22:00 UTC
    This seems as if it will solve my problem. If I have installed modules on Windows I can certainly overcome CPAN install obstacles.

    A straight directory by directory copy doesnt work so well.

    FYI Here is the result of running CPAN following the copy operation

    z:\Perl>cpan
    Perl lib version (v5.8.8) doesn't match executable version (v5.10.0) at Z:/Perlib/Config.pm line 46.
    Compilation failed in require at Z:/Perl/lib/CPAN.pm line 14.
    BEGIN failed--compilation aborted at Z:/Perl/lib/CPAN.pm line 14.
    Compilation failed in require at Z:\Perl\bin/cpan line 172.
    BEGIN failed--compilation aborted at Z:\Perl\bin/cpan line 172.

    Here is when running perl:
    Perl lib version (v5.8.8) doesn't match executable version (v5.10.0) at Z:/Perllib/Config.pm line 46.
    Compilation failed in require at Z:/Perl/lib/Time/Local.pm line 5.
    BEGIN failed--compilation aborted at Z:/Perl/lib/Time/Local.pm line 5.
    Compilation failed in require at Z:/Perl/lib/HTTP/Date.pm line 12.
    Compilation failed in require at Z:/Perl/lib/LWP/UserAgent.pm line 14.
    ...yadda yadda yadda...

    I am going to restore back up and try several routes using autobundle. Again my thanks.
      You seem to be moving from Perl 5.8 to Perl 5.10. In that case you cannot copy your old modules because the 2 Perl versions are not binary compatible; all modules containing XS code must be either recompiled, or reinstalled using PPM/CPAN.
Re^4: How to move 3 years of modules to my new XP box?
by Anonymous Monk on Nov 27, 2008 at 03:00 UTC
    Corion is being a little terse here.
    Not that I'm conceding Corion was being brief and to the point, but so what if he was?
      Einstin is quoted as saying:
      Make everything as simple as possible, but not simpler.
      To paraphrase:
      Make every post as brief as possible, but not briefer.
      I'll take my own advice and stop now.

      --
      .sig : File not found.