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

Installation & Configuration of Modern Perl

Stevan Little
September 10, 2013

Installation & Configuration of Modern Perl

This is a talk I gave at the Connecticut Perl Mongers meeting.

Stevan Little

September 10, 2013
Tweet

More Decks by Stevan Little

Other Decks in Programming

Transcript

  1. Installation & Configuration of Modern Perl Stevan Little [email protected] CT

    Perl Developers Meetup Tuesday, September 10, 2013 with perlbrew, cpanminus and more.
  2. How many people ... • use system Perl? • use

    Perl on a system without root access?
  3. How many people ... • use system Perl? • use

    Perl on a system without root access? • work with sysadmins who don’t like to install modules?
  4. perlbrew ‣ perlbrew install perl-5.18.0 - installs side-by-side (not overwrite)

    ‣ perlbrew switch perl-5.18.0 - not used until explicitly activated
  5. perlbrew ‣ perlbrew install perl-5.18.0 - installs side-by-side (not overwrite)

    ‣ perlbrew switch perl-5.18.0 - not used until explicitly activated ‣ perlbrew use perl-5.18.0
  6. perlbrew ‣ perlbrew install perl-5.18.0 - installs side-by-side (not overwrite)

    ‣ perlbrew switch perl-5.18.0 - not used until explicitly activated ‣ perlbrew use perl-5.18.0 - can be use temporarily (only in this shell)
  7. perlbrew ‣ perlbrew list - shows list of perls you

    have available ‣ perlbrew available
  8. perlbrew ‣ perlbrew list - shows list of perls you

    have available ‣ perlbrew available - shows list of perls that are available to install
  9. perlbrew ‣ perlbrew list - shows list of perls you

    have available ‣ perlbrew available - shows list of perls that are available to install ‣ perlbrew alias perl-5.18.0 newest
  10. perlbrew ‣ perlbrew list - shows list of perls you

    have available ‣ perlbrew available - shows list of perls that are available to install ‣ perlbrew alias perl-5.18.0 newest - alias an existing perl to a better name
  11. perlbrew ‣ perlbrew list - shows list of perls you

    have available ‣ perlbrew available - shows list of perls that are available to install ‣ perlbrew alias perl-5.18.0 newest - alias an existing perl to a better name ‣ perlbrew uninstall perl-5.6.1
  12. perlbrew ‣ perlbrew list - shows list of perls you

    have available ‣ perlbrew available - shows list of perls that are available to install ‣ perlbrew alias perl-5.18.0 newest - alias an existing perl to a better name ‣ perlbrew uninstall perl-5.6.1 - delete older perl installs
  13. perlbrew ‣ perlbrew self-upgrade - way to upgrade perlbrew itself

    ‣ perlbrew install-cpanm - way to install cpan-minus (more on that soon)
  14. perlbrew ‣ perlbrew self-upgrade - way to upgrade perlbrew itself

    ‣ perlbrew install-cpanm - way to install cpan-minus (more on that soon) ‣ perlbrew lib
  15. perlbrew ‣ perlbrew self-upgrade - way to upgrade perlbrew itself

    ‣ perlbrew install-cpanm - way to install cpan-minus (more on that soon) ‣ perlbrew lib - way to manage local::lib dirs (more on that soon)
  16. plenv • An alternative to perlbrew • https://github.com/tokuhirom/plenv • does

    not depend on perl, written in bash • less invasive to environment
  17. plenv • An alternative to perlbrew • https://github.com/tokuhirom/plenv • does

    not depend on perl, written in bash • less invasive to environment • specifically made to work with Carton
  18. plenv • An alternative to perlbrew • https://github.com/tokuhirom/plenv • does

    not depend on perl, written in bash • less invasive to environment • specifically made to work with Carton • (more about that later)
  19. plenv • An alternative to perlbrew • https://github.com/tokuhirom/plenv • does

    not depend on perl, written in bash • less invasive to environment • specifically made to work with Carton • (more about that later) • I only just learned about it :)
  20. plenv ‣ plenv install perl-5.18.0 - installs side-by-side, no overwrite,

    just like perlbrew ‣ plenv global 5.16.2 - sets the perl for all shells
  21. plenv ‣ plenv install perl-5.18.0 - installs side-by-side, no overwrite,

    just like perlbrew ‣ plenv global 5.16.2 - sets the perl for all shells ‣ plenv shell 5.8.2
  22. plenv ‣ plenv install perl-5.18.0 - installs side-by-side, no overwrite,

    just like perlbrew ‣ plenv global 5.16.2 - sets the perl for all shells ‣ plenv shell 5.8.2 - can be use temporarily (only in this shell)
  23. plenv ‣ plenv install perl-5.18.0 - installs side-by-side, no overwrite,

    just like perlbrew ‣ plenv global 5.16.2 - sets the perl for all shells ‣ plenv shell 5.8.2 - can be use temporarily (only in this shell) ‣ plenv local 5.18.0
  24. plenv ‣ plenv install perl-5.18.0 - installs side-by-side, no overwrite,

    just like perlbrew ‣ plenv global 5.16.2 - sets the perl for all shells ‣ plenv shell 5.8.2 - can be use temporarily (only in this shell) ‣ plenv local 5.18.0 - sets the perl to be used in $CWD using .perl-version file
  25. plenv ‣ plenv exec ack ... - similar to perlbrew

    you can exec via plenv ‣ plenv install-cpanm
  26. plenv ‣ plenv exec ack ... - similar to perlbrew

    you can exec via plenv ‣ plenv install-cpanm - also comes with useful utilities for cpanm
  27. plenv ‣ plenv exec ack ... - similar to perlbrew

    you can exec via plenv ‣ plenv install-cpanm - also comes with useful utilities for cpanm ‣ plenv migrate-modules 5.8.2 5.18.0
  28. plenv ‣ plenv exec ack ... - similar to perlbrew

    you can exec via plenv ‣ plenv install-cpanm - also comes with useful utilities for cpanm ‣ plenv migrate-modules 5.8.2 5.18.0 - and useful means of transfering module installs
  29. local::lib • manage perl modules in your $HOME directory •

    https://metacpan.org/release/local::lib
  30. local::lib • manage perl modules in your $HOME directory •

    https://metacpan.org/release/local::lib • works well with custom perl or system perl
  31. local::lib ‣ use local::lib; - will look in ~/perl5 for

    local perl modules ‣ use local::lib “~/foo”;
  32. local::lib ‣ use local::lib; - will look in ~/perl5 for

    local perl modules ‣ use local::lib “~/foo”; - will look in ~/foo for local perl modules
  33. local::lib ‣ use local::lib; - will look in ~/perl5 for

    local perl modules ‣ use local::lib “~/foo”; - will look in ~/foo for local perl modules ‣ perl -Mlocal::lib=~/foo script.pl
  34. local::lib ‣ use local::lib; - will look in ~/perl5 for

    local perl modules ‣ use local::lib “~/foo”; - will look in ~/foo for local perl modules ‣ perl -Mlocal::lib=~/foo script.pl - or you can use it from the command line
  35. local::lib ‣ use local::lib; - will look in ~/perl5 for

    local perl modules ‣ use local::lib “~/foo”; - will look in ~/foo for local perl modules ‣ perl -Mlocal::lib=~/foo script.pl - or you can use it from the command line ‣ PERL_MB_OPT PERL_MM_OPT PERL5LIB
  36. local::lib ‣ use local::lib; - will look in ~/perl5 for

    local perl modules ‣ use local::lib “~/foo”; - will look in ~/foo for local perl modules ‣ perl -Mlocal::lib=~/foo script.pl - or you can use it from the command line ‣ PERL_MB_OPT PERL_MM_OPT PERL5LIB - or configure your environment to automatically use it
  37. cpanm • Smaller, faster, easier CPAN client • https://metacpan.org/release/App-cpanminus •

    Zero-conf • Plays well with other tools • perlbrew • local::lib
  38. cpanm • Smaller, faster, easier CPAN client • https://metacpan.org/release/App-cpanminus •

    Zero-conf • Plays well with other tools • perlbrew • local::lib • cpanfile (more on that later)
  39. cpanm • Smaller, faster, easier CPAN client • https://metacpan.org/release/App-cpanminus •

    Zero-conf • Plays well with other tools • perlbrew • local::lib • cpanfile (more on that later) • Carton (more on that later)
  40. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo)
  41. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo) ‣ curl -L http://cpanmin.us | perl - App::cpanminus
  42. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo) ‣ curl -L http://cpanmin.us | perl - App::cpanminus - install in a non-system (local) perl
  43. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo) ‣ curl -L http://cpanmin.us | perl - App::cpanminus - install in a non-system (local) perl ‣ perlbrew install-cpanm
  44. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo) ‣ curl -L http://cpanmin.us | perl - App::cpanminus - install in a non-system (local) perl ‣ perlbrew install-cpanm - of course, this is simpler if you are using perlbrew
  45. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo) ‣ curl -L http://cpanmin.us | perl - App::cpanminus - install in a non-system (local) perl ‣ perlbrew install-cpanm - of course, this is simpler if you are using perlbrew ‣ perl -MCPAN -i App::cpanminus
  46. cpanm ‣ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

    - install from the internet into system perl (note the sudo) ‣ curl -L http://cpanmin.us | perl - App::cpanminus - install in a non-system (local) perl ‣ perlbrew install-cpanm - of course, this is simpler if you are using perlbrew ‣ perl -MCPAN -i App::cpanminus - do it the old fashioned way
  47. cpanm ‣ cpanm Plack - install a distribution ‣ cpanm

    Plack/Request.pm - install the distribution this module belongs too
  48. cpanm ‣ cpanm Plack - install a distribution ‣ cpanm

    Plack/Request.pm - install the distribution this module belongs too ‣ cpanm MIYAGAWA/Plack-1.0000.tar.gz
  49. cpanm ‣ cpanm Plack - install a distribution ‣ cpanm

    Plack/Request.pm - install the distribution this module belongs too ‣ cpanm MIYAGAWA/Plack-1.0000.tar.gz - install a tar ball from CPAN
  50. cpanm ‣ cpanm Plack - install a distribution ‣ cpanm

    Plack/Request.pm - install the distribution this module belongs too ‣ cpanm MIYAGAWA/Plack-1.0000.tar.gz - install a tar ball from CPAN ‣ cpanm /path/to/Plack-1.0000.tar.gz
  51. cpanm ‣ cpanm Plack - install a distribution ‣ cpanm

    Plack/Request.pm - install the distribution this module belongs too ‣ cpanm MIYAGAWA/Plack-1.0000.tar.gz - install a tar ball from CPAN ‣ cpanm /path/to/Plack-1.0000.tar.gz - install a tar ball from disk
  52. cpanm ‣ cpanm http://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Plack-0.9990.tar.gz - install a random tar ball

    from the internet ‣ cpanm git://github.com/plack/Plack.git - install from a git repository
  53. cpanm ‣ cpanm http://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Plack-0.9990.tar.gz - install a random tar ball

    from the internet ‣ cpanm git://github.com/plack/Plack.git - install from a git repository ‣ cpanm git://github.com/plack/[email protected]
  54. cpanm ‣ cpanm http://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Plack-0.9990.tar.gz - install a random tar ball

    from the internet ‣ cpanm git://github.com/plack/Plack.git - install from a git repository ‣ cpanm git://github.com/plack/[email protected] - install a specific tag from a git repository
  55. cpanm ‣ cpanm http://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Plack-0.9990.tar.gz - install a random tar ball

    from the internet ‣ cpanm git://github.com/plack/Plack.git - install from a git repository ‣ cpanm git://github.com/plack/[email protected] - install a specific tag from a git repository ‣ cpanm git://github.com/plack/Plack.git@devel
  56. cpanm ‣ cpanm http://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/Plack-0.9990.tar.gz - install a random tar ball

    from the internet ‣ cpanm git://github.com/plack/Plack.git - install from a git repository ‣ cpanm git://github.com/plack/[email protected] - install a specific tag from a git repository ‣ cpanm git://github.com/plack/Plack.git@devel - install a specific branch from a git repository
  57. cpanm ‣ cpanm Plack~1.0000 - install 1.0000 or later ‣

    cpanm Plack~”>= 1.0000, < 2.0000”
  58. cpanm ‣ cpanm Plack~1.0000 - install 1.0000 or later ‣

    cpanm Plack~”>= 1.0000, < 2.0000” - install the latest member of the 1.xxxx family
  59. cpanm ‣ cpanm Plack~1.0000 - install 1.0000 or later ‣

    cpanm Plack~”>= 1.0000, < 2.0000” - install the latest member of the 1.xxxx family ‣ cpanm [email protected]
  60. cpanm ‣ cpanm Plack~1.0000 - install 1.0000 or later ‣

    cpanm Plack~”>= 1.0000, < 2.0000” - install the latest member of the 1.xxxx family ‣ cpanm [email protected] - install a specific version (same as Plack~"== 0.9990")
  61. cpanm ‣ cpanm --force CGI - force install even if

    the tests don’t pass ‣ cpanm --notest Moose
  62. cpanm ‣ cpanm --force CGI - force install even if

    the tests don’t pass ‣ cpanm --notest Moose - save time and skip tests (if you know they pass)
  63. cpanm ‣ cpanm --force CGI - force install even if

    the tests don’t pass ‣ cpanm --notest Moose - save time and skip tests (if you know they pass) ‣ cpanm --reinstall Plack
  64. cpanm ‣ cpanm --force CGI - force install even if

    the tests don’t pass ‣ cpanm --notest Moose - save time and skip tests (if you know they pass) ‣ cpanm --reinstall Plack - force an re-install of an existing package
  65. cpanm ‣ cpanm --force CGI - force install even if

    the tests don’t pass ‣ cpanm --notest Moose - save time and skip tests (if you know they pass) ‣ cpanm --reinstall Plack - force an re-install of an existing package ‣ cpanm --uninstall Plack
  66. cpanm ‣ cpanm --force CGI - force install even if

    the tests don’t pass ‣ cpanm --notest Moose - save time and skip tests (if you know they pass) ‣ cpanm --reinstall Plack - force an re-install of an existing package ‣ cpanm --uninstall Plack - this is experimental, but does its best to un-install
  67. cpanm ‣ cpanm --showdeps . - will list all the

    dependencies it finds for code
  68. cpanm ‣ cpanm --showdeps . - will list all the

    dependencies it finds for code ‣ cpanm --installdeps .
  69. cpanm ‣ cpanm --showdeps . - will list all the

    dependencies it finds for code ‣ cpanm --installdeps . - will install all the dependencies it finds
  70. cpanfile • Based on Module::Install DSL • A foundation for

    other tools ‣ cpanm --installdeps . • Carton (more on that later)
  71. Carton • A tool for managing CPAN dependencies • https://metacpan.org/release/Carton

    • See also • http://weblog.bulknews.net/post/59613058560/carton-1-0-screencast
  72. Carton • A tool for managing CPAN dependencies • https://metacpan.org/release/Carton

    • See also • http://weblog.bulknews.net/post/59613058560/carton-1-0-screencast • https://speakerdeck.com/miyagawa/carton-1-dot-0-at-oscon-2013
  73. Carton • Inspired by Ruby’s Bundler module • Built on

    top of cpanfile, cpanm & local::lib • Still relatively new (read: not totally stable)
  74. Carton • Manages and installs all modules project local •

    but not checked into version control • Uses a cpanfile to keep track of depdencies
  75. Carton • Manages and installs all modules project local •

    but not checked into version control • Uses a cpanfile to keep track of depdencies • allows for module version to be frozen
  76. Carton • Manages and installs all modules project local •

    but not checked into version control • Uses a cpanfile to keep track of depdencies • allows for module version to be frozen • modules can be installed elsewhere using cpanfile
  77. Carton • Manages and installs all modules project local •

    but not checked into version control • Uses a cpanfile to keep track of depdencies • allows for module version to be frozen • modules can be installed elsewhere using cpanfile • will install exactly the version or version range you tell it too
  78. Carton • Manages and installs all modules project local •

    but not checked into version control • Uses a cpanfile to keep track of depdencies • allows for module version to be frozen • modules can be installed elsewhere using cpanfile • will install exactly the version or version range you tell it too • can create “cache” for installing on machine with no network
  79. Carton • Manages and installs all modules project local •

    but not checked into version control • Uses a cpanfile to keep track of depdencies • allows for module version to be frozen • modules can be installed elsewhere using cpanfile • will install exactly the version or version range you tell it too • can create “cache” for installing on machine with no network • don’t take my word for it ...
  80. Pinto • A(nother) tool for managing CPAN dependencies • https://metacpan.org/release/Pinto

    • See also • http://perlmaven.com/pinto-tutorial • http://www.youtube.com/watch?v=oaBBVZFhJUk
  81. Pinto • Inspired by actual CPAN infrastructure • creates a

    company-wide local CPAN • works with all tools (CPAN, cpanm, etc.)
  82. Pinto • Inspired by actual CPAN infrastructure • creates a

    company-wide local CPAN • works with all tools (CPAN, cpanm, etc.) • soon to be a hosted service
  83. Pinto • Inspired by actual CPAN infrastructure • creates a

    company-wide local CPAN • works with all tools (CPAN, cpanm, etc.) • soon to be a hosted service • http://www.stratopan.com
  84. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local
  85. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local • Repositories can be copied into “stacks”
  86. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local • Repositories can be copied into “stacks” • similar to branching in VCS and good for testing upgrades
  87. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local • Repositories can be copied into “stacks” • similar to branching in VCS and good for testing upgrades • modules can be “pinned”
  88. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local • Repositories can be copied into “stacks” • similar to branching in VCS and good for testing upgrades • modules can be “pinned” • prevents all upgrade (even accidental upgrade)
  89. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local • Repositories can be copied into “stacks” • similar to branching in VCS and good for testing upgrades • modules can be “pinned” • prevents all upgrade (even accidental upgrade) • can also manage non-CPAN dependencies
  90. Pinto • Manages and installs modules into a “repository” •

    separate from you VCS and (possibly) non-local • Repositories can be copied into “stacks” • similar to branching in VCS and good for testing upgrades • modules can be “pinned” • prevents all upgrade (even accidental upgrade) • can also manage non-CPAN dependencies • useful if you structure your application like a CPAN distro