Introduction to perlbrew

4d8c65b603554811079a7ea9b7aab9c0?s=47 Kang-min Liu
October 13, 2011

Introduction to perlbrew

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

4d8c65b603554811079a7ea9b7aab9c0?s=128

Kang-min Liu

October 13, 2011
Tweet

Transcript

  1. None
  2. Kang-min Liu @gugod

  3. /me @gugod, ཱུ߁ຽ, Kang-min Liu Web programmer CPAN Author for

    ~100 distributions http://perlbrew.pl
  4. /me @gugod, ཱུ߁ຽ, Kang-min Liu { Perl, Ruby, Javascript, HTML,

    CSS, SQL, Photoshop } programmer CPAN Author for ~100 distributions http://perlbrew.pl
  5. perlbrew

  6. ← /usr/bin/perl /usr/local/bin/perl /opt/local/bin/perl /home/gugod/local/bin/perl

  7. ← /usr/bin/perl5.8.8 /usr/bin/perl5.10.0 /usr/bin/perl site_lib is preserved after upgrade @INC

    gets longer and longer.
  8. 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.
  9. 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.
  10. 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.
  11. The err Errors happens at runtime XS errors happens at

    install / compile time and it is ^%@&* to solve.
  12. Worst of all Have to upgrade perl before doing all

    that. an all-in-ish move
  13. Worst of all Dirty state 100 CPAN modules are updated

    1 failed Can’t easily revert
  14. retreat cp /usr/bin/perl${old} /usr/bin/perl old perl does not contain new

    site_lib
  15. But what if Upgrade perl for... performance bug-fixes evaluation

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

  18. perlbrew A tool to install different versions of perls

  19. admin-free perl installation management

  20. beer-driven software development

  21. rvm 1.8, 1.9, ree, jruby, rubinus, macruby, maglev, ironruby

  22. perlbrew 5.8, 5.9, 5.10, 5.11, 5.12, 5.13, 5.14, 5.15

  23. Installation # 1 curl -kL http://xrl.us/perlbrewinstall | bash # 2

    cpan -i App::perlbrew perlbrew init
  24. 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
  25. Usage perlbrew use perl-5.14.2 perlbrew use perl-5.15.5 perlbrew switch perl-5.14.2

    perlbrew off
  26. Usage perlbrew list

  27. > perlbrew list perl-5.10.0 perl-5.10.1 perl-5.10.1 perl-5.12.3 perl-5.14.1 * perl-5.14.2

    perl-5.14.2@app-awesome perl-5.15.3
  28. Usage perlbrew lib

  29. 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
  30. 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
  31. perlbrew use perl-5.10.1@app-awesome

  32. perlbrew use perl-5.10.1@app-awesome perl installation name

  33. perlbrew use perl-5.10.1@app-awesome local::lib name

  34. perlbrew use perl-5.10.1@app-awesome

  35. eval `perl -Mlocal::lib=~/.perlbrew/ libs/perl-5.10.1@app-awesome/`

  36. % 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
  37. perlbrew.pl 0.30

  38. Properties isolated perl installations bin, site_lib, local::lib install a new

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

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

    possible incompatible issues with other apps. know your libs
  41. 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
  42. Rationale Don’t mess up vendor perl too much. Learn new

    stuffs in the dev version of perl. keep up with the fashion
  43. Rationale Test modules or apps ... with newer perl ...

    with older perl
  44. Rationale Test perl itself -Dusethreads -Duse64bitall -Duse64bitint Configure -h -D

    -U -A
  45. Rationale spare some guts B, XS Better with a perl

    built with DEBUGGING
  46. Thoughts perlbrew « cpanm, ack, rvm

  47. Thoughts One standalone program embed non-core modules very easy distribution

    runs a tiny bit faster
  48. Thoughts rvm bash programming master-piece developer-friendly experiences production uses

  49. 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.
  50. Further Thoughts Good + Simple toolkit Keep new-comers by not

    frustrating them Grow the community
  51. Simple is Hard

  52. Development http://github.com/gugod/App-perlbrew 49 contributors Feedback github issue / pull requests

    rt.cpan.org #perlbrew on twitter
  53. Development http://perlbrew.pl Documentation / Updates A static version of github

    Wiki
  54. Thank You