Perl Resources

Learning perl

Getting perl running on your system

Installing libraries locally

Download the localbrew script to do everything in one go. The script

  1. downloads cpanm
  2. installs local::lib
  3. creates a shell configuration script (~/.p5env) to set up the environment.

Download it via wget:

wget 'https://bargsten.org/down/localbrew.pl'

You can run it via perl localbrew.pl. Additional modules can be given as parameters:

perl localbrew.pl <Mo::du::le::1> <Mo::du::le::2> ... <Mo::du::le::n>

To set up the environment, you have to source the shell configuration:

source ~/.p5env

CPANM

First thing is to set the install directory of your modules

export PERL_CPANM_OPT="--local-lib=~/perl5"
export PATH="$HOME/perl5/bin:$PATH"

and install cpanminus and local::lib

curl -L http://cpanmin.us | perl - App::cpanminus
cpanm local::lib

Getting the environment right

local::lib gives you a local perl library installation, but you have to set the environment right. Usually you add some variables to the environment settings of e.g. bash (.profile or .bash_profile):

perl -I$HOME/perl5/lib/perl5/ -Mlocal::lib >>$HOME/.profile
echo 'export PERL_CPANM_OPT="--local-lib=~/perl5"' >>$HOME/.profile

Installing perl locally

Sometimes you don’t have perl 5.10 available. But also there is a solution. You can run your own locally installed perl version with perlbrew

curl -kL http://install.perlbrew.pl | bash

source ~/perl5/perlbrew/etc/bashrc

perlbrew available

# for x86
perlbrew install perl-5.10.1 -Dusethreads -Duselargefiles -Doptimize=-O2

# for x86_64
perlbrew install perl-5.10.1 -Dusethreads -Duselargefiles -Dcccdlflags=-fPIC -Doptimize=-O2 -Duse64bitall

Perl & Windows

Currently, the best perl distribution for windows is StrawberryPerl.

Writing better perl code

Put this in every perl script you write

#!/usr/bin/env perl

use warnings;
use strict;

use 5.010;

Debugging perl

Webframeworks & CMS

Useful modules

Testing

Install Gonzales Modules

cpanm Bio::Gonzales

Documentation