Upgrading perl

by Dru Lavigne

The other day, my upgrade script informed me that Perl was out of date. I let out a slight groan as I could only imagine how many applications depended upon Perl and envisioned many hours of port rebuilding ahead.

Not surprisingly, /usr/ports/UPDATING had this to say:

AFFECTS: users of lang/perl5.8
AUTHOR: tobez@FreeBSD.org

lang/perl5.8 has been updated to 5.8.7. You should update everything depending on perl. The easiest way to do that is to use perl-after-upgrade script supplied with lang/perl5.8. Please see its manual page for details.

I'm happy to report that the upgrade was not painful at all. I simply did this:

# portupgrade -rR perl
# man perl-after-upgrade

This manpage clearly defined the steps and how to resolve any errors. As advised, I started with the dry run:

# rehash
# perl-after-upgrade

This is where I learned that 81 of my 220 installed applications depended upon Perl! The output also cautioned me that I should check that snmp still worked okay after the upgrade. I then ran the script in work mode:

# perl-after-upgrade -f

On my system, the script worked flawlessly without any errors and took less than 15 minutes to do its thing. The manpage describes what the script actually does:

"The standard procedure after a perl port (either lang/perl5 or lang/perl5.8) upgrade is to basically reinstall all other packages that depend on perl. This is always a painful exercise. The perl-after-upgrade utility makes this process mostly unnecessary.

The tool goes through the list of installed packages, looks for those that depend on perl, moves files around, modifies shebang lines in those scripts in which it is necessary to do so, tries its best to adjust dynamically linked binaries that link with libperl.so in the old path, and updates the package database."

It also indicates that this script is under a BEER-WARE license:

Copyright 2005 by Anton Berezin

wrote this module. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.

Anton Berezin


All I can say is that Anton definitely deserves a beer for making a potentially time-consuming process effortless. No spending days rebuilding 81 applications. And certainly no dependency hell to deal with here.

Being curious, I asked Google a bit about Anton and found his website. His FreeBSD blog contains some interesting Perl scripts. If you play with jails and ports and like Perl, check them out.