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

Introduction to perlbrew

Kang-min Liu
October 13, 2011

Introduction to perlbrew

The perlbrew introduction talk I gave in YAPC::Asia 2011.

Kang-min Liu

October 13, 2011
Tweet

More Decks by Kang-min Liu

Other Decks in Technology

Transcript

  1. /me @gugod, ཱུ߁ຽ, Kang-min Liu { Perl, Ruby, Javascript, HTML,

    CSS, SQL, Photoshop } programmer CPAN Author for ~100 distributions http://perlbrew.pl
  2. The awesomeness perl is very backward compatible Ideal for production

    keep upgrading perl is generally OK don’t necessarily have to upgrade cpan modules following a perl upgrade.
  3. The huh CPAN modules are not necessarily backward compatible. XS

    modules might need to be recompiled with new perl Upgrading modules might not be avoidable.
  4. The hmm The current CPAN architecture sort of encourages upgrading

    The default is to install the latest version of modules. Upgrading CPAN modules isn’t necessarily smooth.
  5. The err Errors happens at runtime XS errors happens at

    install / compile time and it is ^%@&* to solve.
  6. Practicals Module authors have to correctly specify module dependencies. Module

    users have to run tests in order to reveal runtime errors. assuming there are sufficient numbers of tests
  7. !

  8. Usage perlbrew install perl-5.12.2 perlbrew install perl-5.13.5 perlbrew install perl-5.10.1

    perlbrew install perl-5.8.8 * Internet connection is required
  9. Usage perlbrew lib list perlbrew lib create nobita perlbrew lib

    create perl-5.14.2@nobita perlbrew use perl-5.14.2@nobita perlbrew lib delete perl-5.12.3@nobita
  10. cd ~/src/App-Awesome perlbrew use perl-5.10.1@app-awesome perlbrew use perl-5.14.2@app-awesome cd ~/src/Module-Awesome

    perlbrew use perl-5.10.1@nobita perlbrew use perl-5.14.1@nobita perlbrew use perl-5.14.2@nobita
  11. % perl -V ... Compiled at Sep 27 2011 14:08:36

    %ENV: PERL5LIB="/Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome/lib/perl5/darwin-2level:/ Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome/lib/perl5" PERLBREW_BASHRC_VERSION="0.30," PERLBREW_HOME="/Users/gugod/.perlbrew" PERLBREW_LIB="app-awesome" PERLBREW_PATH="/Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome/bin:/Users/gugod/ perl5/perlbrew/bin:/Users/gugod/perl5/perlbrew/perls/perl-5.14.2/bin" PERLBREW_PERL="perl-5.14.2" PERLBREW_ROOT="/Users/gugod/perl5/perlbrew" PERLBREW_VERSION="0.30" PERL_LOCAL_LIB_ROOT="/Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome" PERL_MB_OPT="--install_base /Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome" PERL_MM_OPT="INSTALL_BASE=/Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome" @INC: /Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome/lib/perl5/darwin-2level /Users/gugod/.perlbrew/libs/perl-5.14.2@app-awesome/lib/perl5 /Users/gugod/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level /Users/gugod/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2 /Users/gugod/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-2level /Users/gugod/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2
  12. Properties isolated perl installations bin, site_lib, local::lib install a new

    version ≠ upgrade @INC does not include old site_lib
  13. Benefits `sudo cpan` is no more easier-to-clean perl environments Nuke

    the whole thing to clean the mess No old @INC
  14. Benefits per-app isolated perl environments setup. avoid, in advance, any

    possible incompatible issues with other apps. know your libs
  15. avoid lib conflicts with what you had install older versions

    of modules without worries to break other app code. cpanm http://URL.TO/Mo-0.1.tar.gz App::pmuninstall Benefits
  16. Rationale Don’t mess up vendor perl too much. Learn new

    stuffs in the dev version of perl. keep up with the fashion
  17. Further Thoughts Deprecate switch/use to external perl Improve multi-user scenario

    More related tool to help developer identify module upgrade failure, and revert to a good state.