Slide 1

Slide 1 text

Perl and Perl Module Administration in the Modern Era perlbrew, cpanminus, and local::lib Diab Jerius Smithsonian Astrophysical Observatory 20 March 2013 Code Coffee Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 1 / 25

Slide 2

Slide 2 text

Outline 1 The Tao of Perl Management 2 perlbrew 3 local::lib 4 cpanminus Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 2 / 25

Slide 3

Slide 3 text

The Tao of Perl management Managing Perl and its modules need not be complicated. There are three tools (and maybe fewer) that you need to know about: perlbrew – manage Perl and libraries of Perl Modules cpanm – install Perl modules from CPAN (and beyond) local::lib – manage local Perl Modules Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 3 / 25

Slide 4

Slide 4 text

perlbrew What does it do? perlbrew handles most aspects of managing Perl installations. It can manage multiple versions of Perl install or upgrade Perl (in place!) temporarily or permanently switch your current version of Perl manage separate collections of modules (e.g. development versus production). It works best under POSIX-like shells (bash, zsh, etc.) Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 4 / 25

Slide 5

Slide 5 text

perlbrew When to use it? Use perlbrew for . . . Installing a modern Perl if your system Perl is old or broken Freezing environments for legacy code. Testing/Developing against different versions of Perl Separating libraries of modules for production and development Creating throwaway sandbox environments. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 5 / 25

Slide 6

Slide 6 text

perlbrew How to install it Here’s how to install perlbrew: % curl -skL http://install.perlbrew.pl1 | bash 1A shout out to Poland, the official domain for Perl. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 6 / 25

Slide 7

Slide 7 text

perlbrew Just Install It! % curl -skL http://install.perlbrew.pl | bash Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 7 / 25

Slide 8

Slide 8 text

perlbrew Just Install It! % curl -skL http://install.perlbrew.pl | bash ## Download the latest perlbrew ## Installing perlbrew perlbrew is installed: ˜/perl5/perlbrew/bin/perlbrew perlbrew root (˜/perl5/perlbrew) is initialized. Append the following piece of code to the end of your ˜/.bash_profile and start a new shell, perlbrew should be up and fully functional from there: source ˜/perl5/perlbrew/etc/bashrc Simply run ‘perlbrew‘ for usage details. Happy brewing! ## Installing patchperl ## Done. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 7 / 25

Slide 9

Slide 9 text

perlbrew Just Install It! % curl -skL http://install.perlbrew.pl | bash ## Download the latest perlbrew ## Installing perlbrew perlbrew is installed: ˜/perl5/perlbrew/bin/perlbrew perlbrew root (˜/perl5/perlbrew) is initialized. Append the following piece of code to the end of your ˜/.bash_profile and start a new shell, perlbrew should be up and fully functional from there: source ˜/perl5/perlbrew/etc/bashrc Simply run ‘perlbrew‘ for usage details. Happy brewing! ## Installing patchperl ## Done. % source ˜/perl5/perlbrew/etc/bashrc % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 7 / 25

Slide 10

Slide 10 text

Using perlbrew Installing Perl First, let’s find out which versions of Perl are available: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 8 / 25

Slide 11

Slide 11 text

Using perlbrew Installing Perl First, let’s find out which versions of Perl are available: % perlbrew available Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 8 / 25

Slide 12

Slide 12 text

Using perlbrew Installing Perl First, let’s find out which versions of Perl are available: % perlbrew available perl-5.14.4-RC2 perl-5.16.2 perl-5.14.4 perl-5.12.5 perl-5.10.1 perl-5.8.9 perl-5.6.2 perl5.005_04 perl5.004_05 perl5.003_07 % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 8 / 25

Slide 13

Slide 13 text

Using perlbrew Installing the stable version of Perl Now we’ll install the latest stable version: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 9 / 25

Slide 14

Slide 14 text

Using perlbrew Installing the stable version of Perl Now we’ll install the latest stable version: % perlbrew install stable Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 9 / 25

Slide 15

Slide 15 text

Using perlbrew Installing the stable version of Perl Now we’ll install the latest stable version: % perlbrew install stable Fetching perl 5.16.2 as /home/newbie/perl5/perlbrew/dists/perl-5.16.2.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.16.2 into ˜/perl5/perlbrew/perls/perl-5.16.2 This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.16.2.log Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 9 / 25

Slide 16

Slide 16 text

Using perlbrew Installing the stable version of Perl Now we’ll install the latest stable version: % perlbrew install stable Fetching perl 5.16.2 as /home/newbie/perl5/perlbrew/dists/perl-5.16.2.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.16.2 into ˜/perl5/perlbrew/perls/perl-5.16.2 This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.16.2.log perl-5.16.2 is successfully installed. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 9 / 25

Slide 17

Slide 17 text

Using perlbrew Installing a common older version Let’s also install Perl 5.10.1 to run old production code. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 10 / 25

Slide 18

Slide 18 text

Using perlbrew Installing a common older version Let’s also install Perl 5.10.1 to run old production code. % perlbrew install 5.10.1 Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 10 / 25

Slide 19

Slide 19 text

Using perlbrew Installing a common older version Let’s also install Perl 5.10.1 to run old production code. % perlbrew install 5.10.1 Fetching perl 5.10.1 as /home/newbie/perl5/perlbrew/dists/perl-5.10.1.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.10.1 into ˜/perl5/perlbrew/perls/perl-5.10.1 This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.10.1.log Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 10 / 25

Slide 20

Slide 20 text

Using perlbrew Installing a common older version Let’s also install Perl 5.10.1 to run old production code. % perlbrew install 5.10.1 Fetching perl 5.10.1 as /home/newbie/perl5/perlbrew/dists/perl-5.10.1.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.10.1 into ˜/perl5/perlbrew/perls/perl-5.10.1 This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.10.1.log perl-5.10.1 is successfully installed. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 10 / 25

Slide 21

Slide 21 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 22

Slide 22 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 23

Slide 23 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 24

Slide 24 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 25

Slide 25 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 26

Slide 26 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Now, let’s make 5.16.2 the default: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 27

Slide 27 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Now, let’s make 5.16.2 the default: % perlbrew switch 5.16.2 % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 28

Slide 28 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Now, let’s make 5.16.2 the default: % perlbrew switch 5.16.2 % perlbrew list Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 29

Slide 29 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Now, let’s make 5.16.2 the default: % perlbrew switch 5.16.2 % perlbrew list perl-5.10.1 * perl-5.16.2 % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 30

Slide 30 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Now, let’s make 5.16.2 the default: % perlbrew switch 5.16.2 % perlbrew list perl-5.10.1 * perl-5.16.2 % To temporarily use a different Perl environment in the current shell, % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 31

Slide 31 text

perlbrew Choosing a default Perl At this point we have two versions of Perl installed, but haven’t chosen a default. First, confirm the installed Perls % perlbrew list perl-5.10.1 perl-5.16.2 % Now, let’s make 5.16.2 the default: % perlbrew switch 5.16.2 % perlbrew list perl-5.10.1 * perl-5.16.2 % To temporarily use a different Perl environment in the current shell, % perlbrew use 5.16.2 % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 11 / 25

Slide 32

Slide 32 text

perlbrew Upgrading Perl What if a new point release of Perl is out? Let’s upgrade Perl in place: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 12 / 25

Slide 33

Slide 33 text

perlbrew Upgrading Perl What if a new point release of Perl is out? Let’s upgrade Perl in place: % perlbrew upgrade-perl Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 12 / 25

Slide 34

Slide 34 text

perlbrew Upgrading Perl What if a new point release of Perl is out? Let’s upgrade Perl in place: % perlbrew upgrade-perl Upgrading perl-5.16.2 to 5.16.3 Fetching perl 5.16.3 as /home/newbie/perl5/perlbrew/dists/perl-5.16.3.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.16.3 into ˜/perl5/perlbrew/perls/perl-5.16.2 This could take a while. You can run the following command on another shell to track the status: tail -f /perl5/perlbrew/build.perl-5.16.3.log Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 12 / 25

Slide 35

Slide 35 text

perlbrew Upgrading Perl What if a new point release of Perl is out? Let’s upgrade Perl in place: % perlbrew upgrade-perl Upgrading perl-5.16.2 to 5.16.3 Fetching perl 5.16.3 as /home/newbie/perl5/perlbrew/dists/perl-5.16.3.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.16.3 into ˜/perl5/perlbrew/perls/perl-5.16.2 This could take a while. You can run the following command on another shell to track the status: tail -f /perl5/perlbrew/build.perl-5.16.3.log perl-5.16.2 is successfully installed. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 12 / 25

Slide 36

Slide 36 text

perlbrew Upgrading Perl What if a new point release of Perl is out? Let’s upgrade Perl in place: % perlbrew upgrade-perl Upgrading perl-5.16.2 to 5.16.3 Fetching perl 5.16.3 as /home/newbie/perl5/perlbrew/dists/perl-5.16.3.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.16.3 into ˜/perl5/perlbrew/perls/perl-5.16.2 This could take a while. You can run the following command on another shell to track the status: tail -f /perl5/perlbrew/build.perl-5.16.3.log perl-5.16.2 is successfully installed. % perlbrew list Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 12 / 25

Slide 37

Slide 37 text

perlbrew Upgrading Perl What if a new point release of Perl is out? Let’s upgrade Perl in place: % perlbrew upgrade-perl Upgrading perl-5.16.2 to 5.16.3 Fetching perl 5.16.3 as /home/newbie/perl5/perlbrew/dists/perl-5.16.3.tar.bz2 Installing /home/newbie/perl5/perlbrew/build/perl-5.16.3 into ˜/perl5/perlbrew/perls/perl-5.16.2 This could take a while. You can run the following command on another shell to track the status: tail -f /perl5/perlbrew/build.perl-5.16.3.log perl-5.16.2 is successfully installed. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 12 / 25

Slide 38

Slide 38 text

perlbrew Local libraries perlbrew lib manages libraries (collections) of modules. Libraries are. . . independent collections of modules associated with a single Perl installation stored independently of the associated Perl structured in the standard Perl directory layout especially useful for group development. central repository of Perl installations and production libraries developers have their own libraries for testing and development Unfortunately, only one library may be in use at any one time. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 13 / 25

Slide 39

Slide 39 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 40

Slide 40 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 41

Slide 41 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 42

Slide 42 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 43

Slide 43 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 44

Slide 44 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 45

Slide 45 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 46

Slide 46 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 47

Slide 47 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 48

Slide 48 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Use the @dev one: Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 49

Slide 49 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Use the @dev one: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 50

Slide 50 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Use the @dev one: % perlbrew use @dev Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 51

Slide 51 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Use the @dev one: % perlbrew use @dev % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 52

Slide 52 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Use the @dev one: % perlbrew use @dev % perlbrew list Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 53

Slide 53 text

perlbrew Create some library roots Library creation and management is straightforward. Let’s create two library roots: production & development Create ’em: % perlbrew lib create prod lib ’perl-5.16.2@prod’ is created. % perlbrew lib create dev lib ’perl-5.16.2@dev’ is created. % perlbrew list perl-5.10.1 * perl-5.16.2 (5.16.3) perl-5.16.2@dev perl-5.16.2@prod % Use the @dev one: % perlbrew use @dev % perlbrew list perl-5.10.1 perl-5.16.2 (5.16.3) * perl-5.16.2@dev perl-5.16.2@prod % Now modules will get installed into the @dev library and @prod stays clean. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 14 / 25

Slide 54

Slide 54 text

perlbrew Install cpanm Finally, let’s install cpanminus (cpanm). % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 15 / 25

Slide 55

Slide 55 text

perlbrew Install cpanm Finally, let’s install cpanminus (cpanm). % perlbrew install-cpanm Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 15 / 25

Slide 56

Slide 56 text

perlbrew Install cpanm Finally, let’s install cpanminus (cpanm). % perlbrew install-cpanm cpanm is installed to /home/newbie/perl5/perlbrew/bin/cpanm % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 15 / 25

Slide 57

Slide 57 text

perlbrew Install cpanm Finally, let’s install cpanminus (cpanm). % perlbrew install-cpanm cpanm is installed to /home/newbie/perl5/perlbrew/bin/cpanm % This mode of installation is special to perlbrew There’s another way of installing cpanm when not using perlbrew. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 15 / 25

Slide 58

Slide 58 text

perlbrew How does it work? Ok, but how does it work? After you % source ˜/perl5/perlbrew/etc/bashrc perlbrew sets up your environment so that PATH includes the directory containing the selected Perl PERL5LIB includes the library directory (if any). cpanm and cpan will install modules into the correct directory % command -v perl /home/newbie/perl5/perlbrew/perls/perl-5.16.2/bin/perl % printenv PERL5LIB /home/newbie/.perlbrew/libs/perl-5.16.2@dev/lib/perl5 To allow programs to track the environment, encode the Perl location as #! /usr/bin/env perl and they will use the first Perl found in your PATH. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 16 / 25

Slide 59

Slide 59 text

perlbrew Hardcoding the environment To ensure your code runs against a particular environment Encode the absolute location to Perl in the main program: #! /home/newbie/perl5/perlbrew/perls/perl-5.16.2/bin/perl To specify a lib root, do it either explicitly use ’/home/newbie/.perlbrew/libs/perl-5.16.2dev/lib/perl5’; or via local::lib use local::lib ’/home/newbie/.perlbrew/libs/perl-5.16.2@dev’; make sure that local::lib is installed for the base Perl, e.g. % perlbrew switch 5.16.2 % cpanm local::lib Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 17 / 25

Slide 60

Slide 60 text

perlbrew Hardcoding the environment, the easy way The easiest way to hard-code the environment is to not use libraries. Just install the required version of Perl with a different name: % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 18 / 25

Slide 61

Slide 61 text

perlbrew Hardcoding the environment, the easy way The easiest way to hard-code the environment is to not use libraries. Just install the required version of Perl with a different name: % perlbrew install 5.10.1 --as 5.10.1-prod Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 18 / 25

Slide 62

Slide 62 text

perlbrew Hardcoding the environment, the easy way The easiest way to hard-code the environment is to not use libraries. Just install the required version of Perl with a different name: % perlbrew install 5.10.1 --as 5.10.1-prod Installing /home/newbie/perl5/perlbrew/build/perl-5.10.1 into ˜/perl5/perlbrew/perls/perl-5.10.1-prod This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.10.1.log Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 18 / 25

Slide 63

Slide 63 text

perlbrew Hardcoding the environment, the easy way The easiest way to hard-code the environment is to not use libraries. Just install the required version of Perl with a different name: % perlbrew install 5.10.1 --as 5.10.1-prod Installing /home/newbie/perl5/perlbrew/build/perl-5.10.1 into ˜/perl5/perlbrew/perls/perl-5.10.1-prod This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.10.1.log perl-5.10.1-prod is successfully installed. % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 18 / 25

Slide 64

Slide 64 text

perlbrew Hardcoding the environment, the easy way The easiest way to hard-code the environment is to not use libraries. Just install the required version of Perl with a different name: % perlbrew install 5.10.1 --as 5.10.1-prod Installing /home/newbie/perl5/perlbrew/build/perl-5.10.1 into ˜/perl5/perlbrew/perls/perl-5.10.1-prod This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.10.1.log perl-5.10.1-prod is successfully installed. % perlbrew list Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 18 / 25

Slide 65

Slide 65 text

perlbrew Hardcoding the environment, the easy way The easiest way to hard-code the environment is to not use libraries. Just install the required version of Perl with a different name: % perlbrew install 5.10.1 --as 5.10.1-prod Installing /home/newbie/perl5/perlbrew/build/perl-5.10.1 into ˜/perl5/perlbrew/perls/perl-5.10.1-prod This could take a while. You can run the following command on another shell to track the status: tail -f ˜/perl5/perlbrew/build.perl-5.10.1.log perl-5.10.1-prod is successfully installed. % perlbrew list 5.10.1-prod perl-5.10.1 perl-5.16.2 (5.16.3) * perl-5.16.2@dev perl-5.16.2@prod % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 18 / 25

Slide 66

Slide 66 text

local::lib A Local Library Use local::lib if . . . the locally available Perl is sufficient; and you just want to easily install Perl modules Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 19 / 25

Slide 67

Slide 67 text

local::lib Installation local::lib is slightly more complex to install % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 68

Slide 68 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 69

Slide 69 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 70

Slide 70 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 71

Slide 71 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work... Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 72

Slide 72 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work... Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 73

Slide 73 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 74

Slide 74 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 75

Slide 75 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 76

Slide 76 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 77

Slide 77 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % source ˜/perl5/etc/locallibrc % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 78

Slide 78 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % source ˜/perl5/etc/locallibrc % perl cpanm App::cpanminus Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 79

Slide 79 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % source ˜/perl5/etc/locallibrc % perl cpanm App::cpanminus work... Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 80

Slide 80 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % source ˜/perl5/etc/locallibrc % perl cpanm App::cpanminus work...work... Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 81

Slide 81 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % source ˜/perl5/etc/locallibrc % perl cpanm App::cpanminus work...work...work... Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 82

Slide 82 text

local::lib Installation local::lib is slightly more complex to install % curl -sLO http://xrl.us/cpanm % PERL5LIB=˜/perl5/lib/perl5 perl cpanm -n --local-lib=˜/perl5 local::lib -> Working on local::lib Fetching http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ... OK ==> Found dependencies: ExtUtils::MakeMaker work...work...work... Successfully installed local-lib-1.008009 7 distributions installed % mkdir ˜/perl5/etc % echo ’eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)’ > ˜/perl5/etc/locallibrc % source ˜/perl5/etc/locallibrc % perl cpanm App::cpanminus work...work...work... Successfully installed App-cpanminus-1.6008 1 distribution installed % Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 20 / 25

Slide 83

Slide 83 text

local::lib How does it work? How does it work? After you % source ˜/perl5/etc/locallibrc local::lib sets up your environment so that PERL5LIB includes the library directory: % printenv PERL5LIB /home/newbie/perl5/lib/perl5 so that Perl programs will see the local library. cpanm and cpan will install modules into the library directory Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 21 / 25

Slide 84

Slide 84 text

cpanminus What is it? cpanm (more formally cpanminus) installs Perl modules a more modern companion of the cpan program install from CPAN, local disk, http://github.com install into custom locations install specific versions (or version ranges) of modules generate module dependency graphs without installing modules follows the dependency graph and automatically installs required modules works seamlessly with perlbrew and local::lib Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 22 / 25

Slide 85

Slide 85 text

cpanminus What is CPAN? CPAN is. . . http://cpan.org http://metacpan.org the repository of Perl modules: numerical algorithms, process control, asynchronous IO, high-performance web servers, web frameworks, . . . . the solution to most of your (Perl programming) needs. Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 23 / 25

Slide 86

Slide 86 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 87

Slide 87 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash -> Working on XML::Hash Fetching http://www.cpan.org/authors/id/B/BR/BRACETA/XML-Hash/XML-Hash-0.95.tar.gz ... OK Configuring XML-Hash-0.95 ... OK ==> Found dependencies: XML::DOM, Test::XML, XML::Simple, File::Slurp -> Working on XML::DOM Fetching http://www.cpan.org/authors/id/T/TJ/TJMATHER/XML-DOM-1.44.tar.gz ... OK Configuring XML-DOM-1.44 ... OK ==> Found dependencies: XML::Parser::PerlSAX, LWP::UserAgent, XML::RegExp, XML::Parser -> Working on XML::Parser::PerlSAX Fetching http://www.cpan.org/authors/id/K/KM/KMACLEOD/libxml-perl-0.08.tar.gz ... OK Configuring libxml-perl-0.08 ... OK ==> Found dependencies: XML::Parser -> Working on XML::Parser Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 88

Slide 88 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Fetching http://www.cpan.org/authors/id/T/TO/TODDR/XML-Parser-2.41.tar.gz ... OK Configuring XML-Parser-2.41 ... OK ==> Found dependencies: LWP -> Working on LWP Fetching http://www.cpan.org/authors/id/G/GA/GAAS/libwww-perl-6.05.tar.gz ... OK Configuring libwww-perl-6.05 ... OK ==> Found dependencies: URI::Escape, LWP::MediaTypes, Encode::Locale, HTTP::Status, HTTP: -> Working on URI::Escape Fetching http://www.cpan.org/authors/id/G/GA/GAAS/URI-1.60.tar.gz ... OK Configuring URI-1.60 ... OK Building URI-1.60 ... OK Successfully installed URI-1.60 -> Working on LWP::MediaTypes Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 89

Slide 89 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Fetching http://www.cpan.org/authors/id/G/GA/GAAS/LWP-MediaTypes-6.02.tar.gz ... OK Configuring LWP-MediaTypes-6.02 ... OK Building LWP-MediaTypes-6.02 ... OK Successfully installed LWP-MediaTypes-6.02 -> Working on Encode::Locale Fetching http://www.cpan.org/authors/id/G/GA/GAAS/Encode-Locale-1.03.tar.gz ... OK Configuring Encode-Locale-1.03 ... OK Building Encode-Locale-1.03 ... OK Successfully installed Encode-Locale-1.03 -> Working on HTTP::Status Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Message-6.06.tar.gz ... OK Configuring HTTP-Message-6.06 ... OK ==> Found dependencies: IO::HTML, HTTP::Date Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 90

Slide 90 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash -> Working on IO::HTML Fetching http://www.cpan.org/authors/id/C/CJ/CJM/IO-HTML-1.00.tar.gz ... OK Configuring IO-HTML-1.00 ... OK Building IO-HTML-1.00 ... OK Successfully installed IO-HTML-1.00 -> Working on HTTP::Date Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Date-6.02.tar.gz ... OK Configuring HTTP-Date-6.02 ... OK Building HTTP-Date-6.02 ... OK Successfully installed HTTP-Date-6.02 Building HTTP-Message-6.06 ... OK Successfully installed HTTP-Message-6.06 -> Working on HTTP::Negotiate Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 91

Slide 91 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Negotiate-6.01.tar.gz ... OK Configuring HTTP-Negotiate-6.01 ... OK Building HTTP-Negotiate-6.01 ... OK Successfully installed HTTP-Negotiate-6.01 -> Working on File::Listing Fetching http://www.cpan.org/authors/id/G/GA/GAAS/File-Listing-6.04.tar.gz ... OK Configuring File-Listing-6.04 ... OK Building File-Listing-6.04 ... OK Successfully installed File-Listing-6.04 -> Working on HTML::Entities Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTML-Parser-3.69.tar.gz ... OK Configuring HTML-Parser-3.69 ... OK ==> Found dependencies: HTML::Tagset Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 92

Slide 92 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash -> Working on HTML::Tagset Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/HTML-Tagset-3.20.tar.gz ... OK Configuring HTML-Tagset-3.20 ... OK Building HTML-Tagset-3.20 ... OK Successfully installed HTML-Tagset-3.20 Building HTML-Parser-3.69 ... OK Successfully installed HTML-Parser-3.69 -> Working on HTTP::Daemon Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Daemon-6.01.tar.gz ... OK Configuring HTTP-Daemon-6.01 ... OK Building HTTP-Daemon-6.01 ... OK Successfully installed HTTP-Daemon-6.01 -> Working on Net::HTTP Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 93

Slide 93 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Fetching http://www.cpan.org/authors/id/G/GA/GAAS/Net-HTTP-6.06.tar.gz ... OK Configuring Net-HTTP-6.06 ... OK Building Net-HTTP-6.06 ... OK Successfully installed Net-HTTP-6.06 -> Working on HTTP::Cookies Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Cookies-6.01.tar.gz ... OK Configuring HTTP-Cookies-6.01 ... OK Building HTTP-Cookies-6.01 ... OK Successfully installed HTTP-Cookies-6.01 -> Working on WWW::RobotRules Fetching http://www.cpan.org/authors/id/G/GA/GAAS/WWW-RobotRules-6.02.tar.gz ... OK Configuring WWW-RobotRules-6.02 ... OK Building WWW-RobotRules-6.02 ... OK Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 94

Slide 94 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Successfully installed WWW-RobotRules-6.02 Building libwww-perl-6.05 ... OK Successfully installed libwww-perl-6.05 Building XML-Parser-2.41 ... OK Successfully installed XML-Parser-2.41 Building libxml-perl-0.08 ... OK Successfully installed libxml-perl-0.08 -> Working on XML::RegExp Fetching http://www.cpan.org/authors/id/T/TJ/TJMATHER/XML-RegExp-0.04.tar.gz ... OK Configuring XML-RegExp-0.04 ... OK Building XML-RegExp-0.04 ... OK Successfully installed XML-RegExp-0.04 Building XML-DOM-1.44 ... OK Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 95

Slide 95 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Successfully installed XML-DOM-1.44 -> Working on Test::XML Fetching http://www.cpan.org/authors/id/S/SE/SEMANTICO/Test-XML-0.08.tar.gz ... OK Configuring Test-XML-0.08 ... OK ==> Found dependencies: XML::SemanticDiff -> Working on XML::SemanticDiff Fetching http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-SemanticDiff-1.0000.tar.gz ... O Configuring XML-SemanticDiff-1.0000 ... OK Building XML-SemanticDiff-1.0000 ... OK Successfully installed XML-SemanticDiff-1.0000 Building Test-XML-0.08 ... OK Successfully installed Test-XML-0.08 -> Working on XML::Simple Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 96

Slide 96 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Fetching http://www.cpan.org/authors/id/G/GR/GRANTM/XML-Simple-2.20.tar.gz ... OK Configuring XML-Simple-2.20 ... OK ==> Found dependencies: XML::SAX, XML::NamespaceSupport, XML::SAX::Expat -> Working on XML::SAX Fetching http://www.cpan.org/authors/id/G/GR/GRANTM/XML-SAX-0.99.tar.gz ... OK Configuring XML-SAX-0.99 ... OK ==> Found dependencies: XML::NamespaceSupport, XML::SAX::Base -> Working on XML::NamespaceSupport Fetching http://www.cpan.org/authors/id/P/PE/PERIGRIN/XML-NamespaceSupport-1.11.tar.gz .. Configuring XML-NamespaceSupport-1.11 ... OK Building XML-NamespaceSupport-1.11 ... OK Successfully installed XML-NamespaceSupport-1.11 -> Working on XML::SAX::Base Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 97

Slide 97 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Fetching http://www.cpan.org/authors/id/G/GR/GRANTM/XML-SAX-Base-1.08.tar.gz ... OK Configuring XML-SAX-Base-1.08 ... OK Building XML-SAX-Base-1.08 ... OK Successfully installed XML-SAX-Base-1.08 Building XML-SAX-0.99 ... OK Successfully installed XML-SAX-0.99 -> Working on XML::SAX::Expat Fetching http://www.cpan.org/authors/id/B/BJ/BJOERN/XML-SAX-Expat-0.40.tar.gz ... OK Configuring XML-SAX-Expat-0.40 ... OK Building XML-SAX-Expat-0.40 ... OK Successfully installed XML-SAX-Expat-0.40 Building XML-Simple-2.20 ... OK Successfully installed XML-Simple-2.20 Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 98

Slide 98 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash -> Working on File::Slurp Fetching http://www.cpan.org/authors/id/U/UR/URI/File-Slurp-9999.19.tar.gz ... OK Configuring File-Slurp-9999.19 ... OK Building File-Slurp-9999.19 ... OK Successfully installed File-Slurp-9999.19 Building XML-Hash-0.95 ... OK Successfully installed XML-Hash-0.95 28 distributions installed Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 99

Slide 99 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash Glad I’m not installing all of those by hand! Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 100

Slide 100 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash To use the new module, temporarily update Perl’s search path: % export PERL5LIB=$PWD/xml-trials/lib/perl5:$PERL5LIB Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 101

Slide 101 text

cpanminus In action cpanm in action is typically quite boring. Here’s one use: I’d like to test an XML document handling module available from CPAN I don’t want to permanently store any of its dependencies % cpanm -n -l xml-trials XML::Hash To use the new module, temporarily update Perl’s search path: % export PERL5LIB=$PWD/xml-trials/lib/perl5:$PERL5LIB And delete it when done... % rm -rf xml-trials Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 24 / 25

Slide 102

Slide 102 text

Summary perlbrew – great in complex development and deployment environments local::lib – is for everything else cpanm – works everywhere and is the bee’s knees Diab Jerius (SAO) Managing Perl & Perl Modules Code Coffee 2013-03-20 25 / 25