While I've tried to be accurate as possible, this should be considered a record of my experience and not gospel on how to do this correctly. It should be a supplement to knowing what you are actually doing, not a replacement. :)
Much of the information here isn't specific to FreeBSD, although that operating system is assumed throughout the document. As well, all the shell syntax examples are using the bash shell.
However, Perl on our system is primarily used for CGI programming, commonly with a database backend. The CGI and DBI modules are core to our use of Perl at Summersault. The most recent versions of CGI.pm now include a "require" statement for Perl 5.6, and the Changes file for DBI 1.30 threatens to require at least Perl 5.6 soon. These occurances provide two reasons to upgrade. First to keep to up to date with modules that are core to our usage of Perl. Secondly, these are strong endorsements for upgrading by module authors I respect.
It also didn't seem likely that it would be reasonable to hold out and skip the whole the 5.8 series without upgrading from 5.005, if only because modules would increasingly require a version of Perl newer than what we were running. Since I'd heard good things about 5.8.0 being a very stable, quality release, my feeling was that this could be a good way to skip the hassle of first upgrading to 5.6 and possibly be "set" for a while, possibly until Perl 6. Now we've been running Perl 5.8 for a couple of weeks, and have noticed no glitches other than the things noted in the upgrade process below, which don't appear to be cauesd by bugs in Perl from what I can tell.
'tar' => q[/usr/local/bin/gtar],
You may need to install gtar from a package or port if you don't have it already. I got some errors until I did this.
'dontload_hash' => {"Net::FTP" => 1, "LWP" =>1 },
cache_metadata=>,
Perl 5.8 may actually complain if this hash key is missing.
That will create a file with a name like "Bundle/Snapshot_2002_07_23_00.pm" that you can use to re-install the modules from. This file will be created in your .cpan directory, which is in /root by default.# As root $ /usr/bin/perl -MCPAN -e autobundle
$ cd /usr/ports/lang $ mkdir -p perl5.8/files $ cd perl5.8 $ ftp ftp://ftp.freebsd.org/pub/FreeBSD/branches/4.0-stable/ports/lang +/perl5.8/ # at this point I enter the FTP shell > prompt > mget * > lcd files > cd files > mget * > exit $ cd ..
This finished in about an hour on my 233 Mhz machine with 256 MB RAM and a SCSI hard drive. YMMV.$ cd /usr/ports/lang/perl5.8/ $ make install </pre>
pkg_info -L perl-5.8.0* | grep local/bin | perl -pe 's!/usr/lo +cal/bin/!!'>perl_binaries.txt
With this, I used a little shell scripting to generate the commands I needed to systematically move and symlink all these binaries:
for f in `cat perl_binaries.txt`; { echo "mv /usr/local/bin/$f /usr/local/bin/$f.copy; ln -s /usr/bin/ +$f /usr/local/bin/$f"; }
That will print out the commands but not actually run them for you.
Once that is done, you can proceed to installing the modules. You will need to be in the directory where your "Bundle" directory is located that you created above. (/root/.cpan by default) Note: It's important to make sure you are using the new version of Perl when you do this.cp /usr/libdata/perl/5.00503/CPAN/Config.pm /usr/local/lib/perl5/5.8.0 +/CPAN/Config.pm
/usr/local/bin/perl58.copy -MCPAN -e 'install Bundle::Snapshot_Your_Na +me_Here' | tee perl_module_upgrade_results.txt
Depending on how many modules you need to upgrade and your net connectivity, this could take several hours to complete. Some modules may ask for interactive feedback during the install process, so it's important to actively watch what's happening. For that reason, I use tee above so that I can work with the program interactively and still has a log of what happened for future reference.
I ended up running this command several times, as I would review the output, fix some modules, and try again. Each time I changed the name of the output file, so I could compare the various results if I needed to.
In my case the system tried to install a mod_perl module which wanted to know where my Apache source tree was, which didn't exist. I was able to use Control-C to cause that module to forcefully fail, while continuing on with the rest of the modules. (which was fine in my case, since I didn't need the mod_perl module). Other modules may fail without any interaction. In my case, the DBD::Pg module complained about not being able to find the Postgres libraries in environment variables. (hint to DBD::Pg users: define POSTGRES_LIB AND POSTGRES_INCLUDE before you start).
For cases like that, it will be important to analyze the resulting log to see what modules, if any, need some manual intervention to be installed properly. You can look for this kind of wording in the
perl_module_upgrade_results.txt<code> file: <p> <code> Running make test Make had some problems, maybe interrupted? Won't test Running make install Make had some problems, maybe interrupted? Won't install Bundle summary: The following items in bundle Bundle::Test had install +ation problems: DBD::Pg </pre>
My list of modules that need to be installed from ports included:PERL_VERSION=5.8.0 PERL_VER=5.8.0 PERL5=/usr/local/bin/perl58.copy PERL=/usr/local/bin/perl58.copy PERL_ARCH=mach
This option is explained in the ExtUtils::MakeMaker perldocs as follows:perl58.copy Makefile.PL make install POLLUTE=1
. My bug report and patch for this available here.POLLUTE Release 5.005 grandfathered old global symbol names by providing preprocessor macros for extension source compatibility. As of release 5.6, these preprocessor definitions are not available by default. The POLLUTE flag specifies that the old names should still be defined: perl Makefile.PL POLLUTE=1 Please inform the module author if this is necessary to successfully install a module under 5.6 or later </pre> </blockquote></li> <li><b>GnuPG</b>. GnuPG needed to be patched to <code>make
$img->Write(file=>\*IMAGE,filename=>$filename);
This was fixed by updating the code to just use the "filename" key:
$img->Write(filename=>$filename);
Creating the "use module" verification took a little more effort. First, I didn't wanted to load every module at the same time for fear of the memory consumption. Also, I needed to run the test for all the 5.5 modules as well, and have a good way way to compare the two result sets. I decided to produce a report that gave the module name, an arbitrary delimiter of "XXX" and then a failure message, if any. I used this kind of syntax for both reports, being careful to change the file names and the perl interpreter I was using for the 5.8 report:diff 5.5-bare-module-list.txt 5.8-bare-module-list.txt | grep '>' | te +e only-in-5.5.txt | more
for f in `cat 5.5-bare-module-list.txt`; { echo -n "$f XXX "; perl -M$ +f -e 1; echo; } 2>&1 | tee 5.5-use-module-failures.txt
With reports for both versions in hand, I could now produce a report of modules that were broken in 5.8 but not in 5.5. I did that like this:
diff 5.5-use-module-failures.txt 5.8-use-module-failures.txt | grep '> +.*XXX \w' | tee modules_broken_in_58_and_not_55.txt | more
Any errors at this stage will again need to be addressed by hand.
/usr/local/lib/perl5/5.8.0/CGI/Carp.pm /usr/local/lib/perl5/site_perl/5.8.0/CGI/Carp.pm
The one in site_perl was older was the one being called and emitting the error. I fixed this by copying the newer one over top of the older one:
cp /usr/local/lib/perl5/5.8.0/CGI/Carp.pm /usr/local/lib/perl5/site_pe +rl/5.8.0/CGI/Carp.pm
use CGI qw(param); # .... print popup_menu(-name=>'foo',values=>[0,1]);
It's questionable whether this should have worked in the first place, since popup_menu was explicitly imported. After the upgrade, errors appeared like this:
Undefined subroutine &Sumsault::CgiDB::popup_menu called at
This apparently means that popup_menu was no longer appearing in the namespace when it had been before. This was addressed by explicitly importing the missing function calls:
use CGI qw(param popup_menu);
ls -l /usr/bin/{perl,suidperl,perl5*,sperl*}
You may want to include other perl related binaries in this list if you have changed the default permissions.
/usr/local/bin/use.perl port
for f in `cat perl_binaries.txt`; { echo "mv /usr/local/bin/$f.copy /u +sr/local/bin/$f; "; }
Like last time, this will print out the suggested commands to screen and allow me visually verify things before I copy and pasted them to run.
locate 'httpd-error_log' | grep -v '\.' | xargs tail -50 | egrep -v \ 'does not exist|script not found|invalidate|authentication failure|una +ble to include|commit ineffective|uninitialized value|explicit discon +nect' | more
/usr/local/bin/use.perl system
update: improved formatting at jens suggestion, and html entities thanks to runrig. Added "Why" section on 8/24/02
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Notes on Upgrading Perl to 5.8.0 on FreeBSD 4.5
by jens (Pilgrim) on Aug 23, 2002 at 03:31 UTC | |
by jens (Pilgrim) on Aug 23, 2002 at 03:57 UTC | |
|
erk!
by Notromda (Pilgrim) on Aug 23, 2002 at 20:07 UTC | |
|
Re: Notes on Upgrading to 5.8.0 on a production web server
by Anonymous Monk on Nov 09, 2002 at 15:11 UTC |