Ubuntu 12.04 is out, and I want to upgrade. However, I need to conserve my existing perl 5.12 installation before upgrading. On 12.04, there is perl 5.14 and I would need to reinstall lots of perl modules. I better copy my existing perl installation before ugrading, because the installer will remove the old perl stuff and I cannot determine what I need when the 5.12 modules are gone.

Any ideas how to do this? I have a mix of modules installed from repos, from cpanm, from cpan, and from source. I need

  • a strategy to determine a comprehensive list of my perl modules, their respective origins
  • a sequence in which order to proceed.
  • advice on what to do in case a certain module is not yet available in 5.14.
  • advice on which environment variables and paths to change.
  • Of course I don't know about what exact modules you have installed and if they will work after upgrade, but I haven't run into problems with any perl modules on my system since upgrade (yet?). – jippie May 16 '12 at 8:05
  • the problem is the mix of sources. It's more convenient to install from repos, but for instance, certain 5.14 modules might be removed, or amd64 versions might be tweaked in some way (maybe for DBD::Sybase). - Some modules installed from source might need some customizations. The two perl instances must coexist on 5.14. My prod environment is 5.10 actually. I don't want to be major versions ahead on my dev machine. – knb May 16 '12 at 8:41
  • 1
    Honestly, it's probably time to ignore "system Perl", install Perlbrew, and let it manage your Perl installations. With Perlbrew you can have any Perl version(s) you want, and switch freely between them. Even after upgrading your OS, your Perlbrewed Perls remain valid. – DavidO Jun 9 '12 at 9:46

I would recommend breaking this question up into several parts in order to simplify the responses.

My suggestions below are only a rough outline of my previous migration experiences. I would recommend that you follow up with additional reading.

  1. Develop a strategy to determine a comprehensive list of my Perl modules, and their respective origins

    There are several methods of determining which Perl modules are installed on your system.

    The following command:

    find -L `perl -e '{print join $/, grep {/[^.]/} @INC}'` -name '*pm' 2>/dev/null 

    will list all perl modules including those installed by the default package.

    There are two other commands that can simplify the list to include manually installed modules:

    The command perldoc perllocal will list some details about the modules version and their installed location.

    Another command is sudo instmodsh. which will provide a simple list of installed modules.

    There are other questions posted here that may help determine whether your module is part of the core distribution or not.

  2. Build a migration plan to determine the order to proceed with the migration.

    I would recommend using Perl's autobundle option to create a snapshot of your installed modules using the command: perl -MCPAN -e 'autobundle'

    The final output will be something like this:

    wrote bundle file /home/somerandomuser/.cpan/Bundle/Snapshot_2012_11_13_00.pm

    Be sure to make a note of that file as you will need it to restore the snapshot later when issuing the next command after your system upgrade:

    perl -MCPAN -e 'install Bundle::Snapshot_2012_11_13_00'
  3. Advice on what to do in case a certain module is not yet available in 5.14.
    Read about the different modules on CPAN and their availability in new Perl releases.

  4. Finally, and most importantly, I would highly recommend installing Perlbrew and TEST. TEST. TEST. My instructions are not meant to be taken as a step-by-step failproof installation guideline but a rough outline of the process

I hope that this points you in the right direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.