In May I decided to stop using Debian's perl 5.10.1 in favor of using a 5.13.1 built with perlbrew, and CPAN modules built with cpanminus. It's been great, here's how I did it.
Before switching over I ignored Debian's perl library packages, and installed everything with
/usr/local. But since I wanted to use the new post-5.10 features of Perl I thought I might as well replace all of it and use a newer perl.
What I did:
- Created a
v-perlbrewuser. All users on the server can use this centrally managed Perl and its modules
- Added this to everyone's
test -f ~/perl5/perlbrew/etc/bashrc && source ~/perl5/perlbrew/etc/bashrc
- Made a list of CPAN modules that I need. When I upgrade the perlbrew perl I can just run
grep -v ^# cpan-modules | cpanmto get all the required modules with the new perl.
- Ran around changing
PATHin crontabs, Apache settings etc. so that everything that isn't internal to Debian itself uses perlbrew's perl instead of
Getting the PATHs right everywhere turned out to be the hardest part. A lot of things in Debian have a path like
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin. I haven't found out how to change that, presumably some of them are hardcoded into executables like bash.
To get around that I have to hardcode the
PATH to perlbrew in every crontab that uses perl. For a full list of these and other changes I've made the output of
git --git-dir /etc/.git log -p --reverse -Sperlbrew available as a Gist.
The only caveat I've encountered is that there's one global perlbrew bashrc in
~/perl5/perlbrew/etc/bashrc. So if I can't use
perlbrew switch to only switch some users onto a given perl. It would be neat if perlbrew supported having the
current symlinks in a local
~/perl5 while the actual binaries and modules were in