Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Perl and Perl Module Administration in the Modern Era

djerius
March 20, 2013

Perl and Perl Module Administration in the Modern Era

The Perl provided by your OS is ancient (yes, it is) and probably broken. We can fix that. Most of your programming problems are probably solved by a Perl module from CPAN, but if you don't know what that is, or how to install modules from it, you'll never use it. We can fix that as well. You've got production code that needs to keep running, but you still want to forge on with modern tools and approaches. We can help with that as well.
This talk provides a rapid introduction to perlbrew, cpanminus, and local::lib.

djerius

March 20, 2013
Tweet

Transcript

  1. 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

    View Slide

  2. 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

    View Slide

  3. 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

    View Slide

  4. 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

    View Slide

  5. 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

    View Slide

  6. 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

    View Slide

  7. 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

    View Slide

  8. 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

    View Slide

  9. 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

    View Slide

  10. 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

    View Slide

  11. 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

    View Slide

  12. 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

    View Slide

  13. 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

    View Slide

  14. 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

    View Slide

  15. 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

    View Slide

  16. 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

    View Slide

  17. 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

    View Slide

  18. 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

    View Slide

  19. 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

    View Slide

  20. 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

    View Slide

  21. 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

    View Slide

  22. 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

    View Slide

  23. 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

    View Slide

  24. 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

    View Slide

  25. 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

    View Slide

  26. 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

    View Slide

  27. 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

    View Slide

  28. 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

    View Slide

  29. 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

    View Slide

  30. 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

    View Slide

  31. 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

    View Slide

  32. 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

    View Slide

  33. 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

    View Slide

  34. 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

    View Slide

  35. 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

    View Slide

  36. 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

    View Slide

  37. 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

    View Slide

  38. 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

    View Slide

  39. 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

    View Slide

  40. 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

    View Slide

  41. 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

    View Slide

  42. 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

    View Slide

  43. 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

    View Slide

  44. 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

    View Slide

  45. 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

    View Slide

  46. 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

    View Slide

  47. 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

    View Slide

  48. 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

    View Slide

  49. 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

    View Slide

  50. 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

    View Slide

  51. 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

    View Slide

  52. 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

    View Slide

  53. 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

    View Slide

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

    View Slide

  55. 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

    View Slide

  56. 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

    View Slide

  57. 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

    View Slide

  58. 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

    View Slide

  59. 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

    View Slide

  60. 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

    View Slide

  61. 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

    View Slide

  62. 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

    View Slide

  63. 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

    View Slide

  64. 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

    View Slide

  65. 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

    View Slide

  66. 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

    View Slide

  67. 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

    View Slide

  68. 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

    View Slide

  69. 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

    View Slide

  70. 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

    View Slide

  71. 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

    View Slide

  72. 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

    View Slide

  73. 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

    View Slide

  74. 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

    View Slide

  75. 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

    View Slide

  76. 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

    View Slide

  77. 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

    View Slide

  78. 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

    View Slide

  79. 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

    View Slide

  80. 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

    View Slide

  81. 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

    View Slide

  82. 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

    View Slide

  83. 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

    View Slide

  84. 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

    View Slide

  85. 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

    View Slide

  86. 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

    View Slide

  87. 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

    View Slide

  88. 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

    View Slide

  89. 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

    View Slide

  90. 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

    View Slide

  91. 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

    View Slide

  92. 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

    View Slide

  93. 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

    View Slide

  94. 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

    View Slide

  95. 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

    View Slide

  96. 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

    View Slide

  97. 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

    View Slide

  98. 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

    View Slide

  99. 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

    View Slide

  100. 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

    View Slide

  101. 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

    View Slide

  102. 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

    View Slide