Upgrade in Place with Perlbrew

| 3 Comments

Per Perl's compatibility and support policy, minor releases of Perl 5 such as Perl 5.16.0 and 5.16.3 share the same level of binary compatibility, while major releases of Perl such as Perl 5.14, 5.16, and Perl 5.18 do not share binary compatibility. That is to say, modules built and installed for one major version of Perl are not necessarily compatible with modules built and installed for another major version.

Because of the new Perl 5 yearly release schedule, you may find yourself wanting to upgrade your Perl far more frequently than in years past. The perlbrew utility helps you manage your own installations, which allows you both to leave the system Perl as it us and to install your own version or versions of Perl for your own purposes.

Because your OS vendor is not in control of these Perls, you can upgrade them or neglect them at your leisure.

When new minor releases come out (as they've done recently), you get to decide when and how to update your managed Perl installations. If you're like me, you have hundreds or thousands of CPAN distributions installed, and the thought of spending a couple of hours reinstalling those seems less than fun. Fortunately, Perlbrew includes a command called upgrade-perl which will download, configure, compile, and install the latest minor version of the current major version family you're using as a replacement. Your modules stay installed and working.

Perlbrew will even figure out if there's a newer minor release available for you.

(As with all updates, there's a small risk of code changes affecting behaviors you care about, but that's why your code has a comprehensive test suite, right?)

From a managed Perl, run the command:

$ perlbrew upgrade-perl

In a few minutes, you'll have a new binary running in your existing environment. Isn't that easy? Thanks, perlbrew!

3 Comments

If the bits of which you need to manage your own installations are not exclusively Perly ones (mine never quite are), allow me to recommend pkgsrc, a cross-platform root-optional source-based package manager. Here's a recent lightning talk I gave about it for a similar use case.

I've just been hit by the fact that upgrade-perl ignores flags set during original installation, e.g. resulting in a change of archname:


$ perlbrew install 5.16.1 --as 5.16_threads -Dusethreads
$ perlbrew upgrade-perl


$ perl5.16.1 -E 'say for map m|5.16_threads/lib/(.*)|, @INC'
site_perl/5.16.1/i686-linux-thread-multi
site_perl/5.16.1
5.16.1/i686-linux-thread-multi
5.16.1


$ perl5.16.3 -E 'say for map m|5.16_threads/lib/(.*)|, @INC'
site_perl/5.16.3/i686-linux
site_perl/5.16.3
5.16.3/i686-linux
5.16.3
site_perl/5.16.1
site_perl

As you can see, my precious site_perl/5.16.1/i686-linux-thread-multi is gone...

OK, "perlbrew install 5.16.1 --as 5.16_threads -Dusethreads --force" fixed this. A ticket has already been open: https://github.com/gugod/App-perlbrew/issues/294

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

affiliated with ModernPerl.net

Categories

Pages

About this Entry

This page contains a single entry by chromatic published on March 12, 2013 7:35 PM.

Clean Your Room was the previous entry in this blog.

Mrs. Feynman's Advice on Programming Language Popularity Contests is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


Sponsored by Blender Recipe Reviews and the Trendshare how to invest guide

Powered by the Perl programming language

what is programming?