Upgrading while keeping all your settings/modules intact

Posted by berniec on 2013-10-22 09:05

I discovered that my current AS perl, 5.12, is no longer ppm'able [without a business license] so I'm upgrading to 5.16. I'm worried about how that 'upgrade' should/will go. right now perl is installed in c:\perl64. Can I just install the new 5.16 in the same directory and will it basically leave my installed modules and other such along [perhaps needing a big update via ppm, but still there]? Or will I run into problems?

ActiveState Staff
Tue, 2013-10-22 12:55

Anything with a binary component is linked against a specific major release of Perl. Perl major releases are always binary incompatible with older releases. If you swap out the Perl to a different major release without re-compiling the binaries, the modules will crash when you load them.

To upgrade safely, you need to manually remove all the modules on the old PATH before you re-use it. But before you remove them, use command-line PPM to generate a list of your current modules. That way you have something to use as input to a script when you go to re-install modules for the new version.

berniec | Tue, 2013-10-22 14:02

So the safest thing to do is, in essence, uninstall my old version of Perl [after making a list of modules], install the new version, and then hack up a script. basically a series of
ppm install --force [next entry from the list]

Two things, I assume I should only do this for the modules that list as "site" -- the ones that say "perl" probably come with the distribution. I also don't fully understand the difference in this procedure between package and module. For example, I found in my list:

SQL-Statement ? 1.402 ? 41 ? 730 KB ? site ?
SQL-Statement ? 1.31 ? 21 ? 347 KB ? perl ?

I guess that since it does have a 'site' entry I should re-install it. THANKS!! /bernie\

berniec | Wed, 2013-10-23 09:35

In case anyone cares, it is easy enough to re-load your modules. this little script:

# Set up a batch script that'll "reinstall" all of your loal packages and
## modules

# $Id: $

use strict;
use warnings ;

open(MODLIST, "-|", "ppm list site")
or die "Can't start ppm: $!\n" ;

; ; ; # Throw away column headings
while ()
{ my ($module) = m/\| ([^ ]*) / ;
last unless $module ;
print "ppm install $module --area site\n" ;
exit ;

when piped into a .bat file should just put everything into the new perl that you had in the old one.

berniec | Tue, 2013-10-29 17:09

Just to follow up, what I did was run my script (above) and got a big file that looked like:

ppm install Clone --area site
ppm install Compress-Raw-Bzip2 --area site
ppm install Compress-Raw-Zlib --area site
ppm install Config-Tiny --area site
ppm install Crypt-SSLeay --area site
ppm install DBD-CSV --area site
ppm install DBD-ODBC --area site
ppm install DBD-SQLite --area site

I then uninstalled Perl 12 and installed Perl 16. Turns out for some reason the batch file wouldn't run, but what worked perfectly was simply to "copy" all of the ppm-install lines and paste them into an admin command prompt. About a half-hour later everything was installed and i'm good to go. No real problems at all, but it was a little scary...:o)

finanztest@free... | Wed, 2014-03-12 02:13

What's about
ppm profile save|restore

Does it work for upgrades?

ActiveState Staff
Wed, 2014-03-12 07:51

"ppm profile" works for upgrading from Perl 5.14 to something newer.

The older PPM::Profile module mentioned in the documentation for Perl 5.12 and older was written for moving from PPM v3 to PPM v4. It has limitations that mean it can't work if you are moving from one v4 to a newer v4. The shopping list approach will work with all versions.