Bootstrapping Perl with Perlbrew and CPAN

Software

@Stilgherrian reminded me that there are still Perl devs out there. It can be a lonely existence, what with all these newfangled languages that don’t act like Swiss Army Chainsaws. And Perlbrew by the illustrious gugod and friends is still the best way to get it, for three reasons:

  1. It’s Perl.

  2. You’ll likely get versions fresher than your package manager of choice.

  3. You can build environments with specific versions and packages for individual projects, where containers or gaols jails or whatever aren’t practical. Drive space is cheaper than dependency hell.

The website lists full install details, but this is a self-explanatory use case:

$ \curl -Lo install.sh https://install.perlbrew.pl
$ cat install.sh
$ sh install.sh
$ echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.bashrc
$ perlbrew install stable
$ perlbrew switch perl-5.26.0

You should always inspect install scripts you download before running them, rather than just piping to your shell. For security obviously, and others.

A Sasara anime figure from Clara on top of several Perl tomes

Now you have street cred, because you can ride camels on streets. Also, this folder exists in plain sight in your home directory. Why hide the pride like RVM?

$ ls ~
==> perl5/

After opening a new shell, you’ll want to confirm you’re running with the version of Perl you expect:

$ perl -v
==> This is perl 5, version 26, subversion 0 (v5.26.0) built for darwin-2level
==> (with 1 registered patch, see perl -V for more detail)

Then you can install your CPAN packages as per normal, such as this one by Karen Etheridge that I’d consider all but mandatory in 2017.

$ perl -MCPAN -e 'install Acme::ಠ_ಠ'

Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!