Upgrading Perl on FreeBSD

I discovered that I needed to upgrade my perl installation on my FreeBSD boxes from 5.6.2 to 5.8.2 for an application that I was interested in running. However there are two issues with this:

  1. Perl 5.6 is in ports as lang/perl and Perl 5.8 is lang/perl5.8, so a portupgrade on perl would not upgrade to the 5.8 version of perl.
  2. I've installed a ton of perl modules from the ports tree as well. I need to make sure that after upgrading to Perl 5.8 that these modules will still work.

The solution…

# portupgrade -o lang/perl58 perl && use.perl port && portupgrade -f pkg_info -Rq perl*

This instructs portupgrade to upgrade lang/perl to lang/perl5.8, after that is completed the system will be updated to the new installation of perl with the use.perl port, and finally any port that requires perl will be upgraded and reinstalled.