Perlbrew

  • 1,172 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,172
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
8
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • I started writing perlbrew in Feburary, this year, and it have became a lovely tool for hackers.\n
  • I started writing perlbrew in Feburary, this year, and it have became a lovely tool for hackers.\n
  • \n
  • \n
  • Besides vendor perl, when one manually (or done with some port system) build perl, it’s usually /usr/local or /opt/local. I build it in with $HOME/local because I don’t like to do type `sudo`.\n\nI ended up using all of above and upgrading perl become such a dangerous move. Especially when you need to re-compile several binary / XS modules.\n\nThe problem is: you simply forgot what to re-complie!\n
  • Besides vendor perl, when one manually (or done with some port system) build perl, it’s usually /usr/local or /opt/local. I build it in with $HOME/local because I don’t like to do type `sudo`.\n\nI ended up using all of above and upgrading perl become such a dangerous move. Especially when you need to re-compile several binary / XS modules.\n\nThe problem is: you simply forgot what to re-complie!\n
  • The perl interpreter is like the most backward program ever. It deprecates no inputs, and produce very consistent result.\n
  • \n
  • Modules tend to be re-write with XS / C for speed improvement. Sometimes the binary is’nt compatible to the old versions. IMHO this basically conflict with site_lib-preserving upgrade policy.\n\nIt does’n always happened, but when it happens, you see errors at runtime. Which makes you anxious: Is there anymore of these sort of errors?\n\n
  • Modules tend to be re-write with XS / C for speed improvement. Sometimes the binary is’nt compatible to the old versions. IMHO this basically conflict with site_lib-preserving upgrade policy.\n\nIt does’n always happened, but when it happens, you see errors at runtime. Which makes you anxious: Is there anymore of these sort of errors?\n\n
  • \n
  • \n
  • \n
  • \n
  • Modules tend to be re-write with XS / C for speed improvement. Sometimes the binary is’nt compatible to the old versions. IMHO this basically conflict with site_lib-preserving upgrade policy.\n\nIt does’n always happened, but when it happens, you see errors at runtime. Which makes you anxious: Is there anymore of these sort of errors?\n\n
  • \n
  • It’s basically designed for single-user, developing purposes.\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • If your CPAN installation somehow get messed up too much, you can always nuke the whole thing to star over.\n\nUpgrading /usr/local/bin/perl to a new version will put keep old site_lib dirs alone with the new site_lib dirs in the @INC. This causes problems particularly on binary modules.\n
  • \n
  • \n
  • \n
  • TEST. OF COURSE. Perl Community really loves to talk about testing. And they hate it sometimes.Just have a more precise idea how your piece of software work with different versions of perl.\n
  • perl interpreter itself must be configured with different compiling arguments to fit certain purses.\n\nQ: perl 5.12 / 5.13 features performance improvements. How much does that benefit my software?\n\n
  • \n
  • Many ideas of perlbrew comes from cpanm. (Distributing / Embedding modules... etc)\nrvm is a comprehensive implementation to build multiple rubies. It’s a big load of bash functions with bash scripts. But it works amazingly well.\n
  • easy to distribute - just one download !\nA pure-perl program pretty much runs anywhere just fine.\n
  • \n
  • These tools I wrote / encountered all feature just one simple job and only that.\n\nThey do not have many sub-commands or arguments so there are very easy to learn.\nNor are they big packages that takes longer to install or to load and run.\n
  • These tools I wrote / encountered all feature just one simple job and only that.\n\nThey do not have many sub-commands or arguments so there are very easy to learn.\nNor are they big packages that takes longer to install or to load and run.\n
  • \n
  • github/social coding is working!\n
  • github/social coding is working!\n
  • \n

Transcript

  • 1. Kang-min Liu @gugod
  • 2. /me@gugod, , Kang-min LiuWeb programmerCPAN Author for ~100 distributionshttp://perlbrew.pl
  • 3. /me@gugod, , Kang-min Liu{ Perl, Ruby, Javascript, HTML, CSS,SQL, Photoshop } programmerCPAN Author for ~100 distributionshttp://perlbrew.pl
  • 4. perlbrew
  • 5.
  • 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/perlsite_lib is preserved after upgrade@INC gets longer and longer.
  • 8. The awesomenessperl is very backward compatibleIdeal for productionkeep upgrading perl is generally OKdon’t necessarily have to upgradecpan modules following a perlupgrade.
  • 9. The huhCPAN modules are not necessarilybackward compatible.XS modules might need to berecompiled with new perlUpgrading modules might not beavoidable.
  • 10. The hmmThe current CPAN architecture sort ofencourages upgrading The default is to install the latest version of modules.Upgrading CPAN modules isn’tnecessarily smooth.
  • 11. The errErrors happens at runtimeXS errors happens at install /compile time and it is ^%@&* tosolve.
  • 12. Worst of allHave to upgrade perl before doing allthat. an all-in-ish move
  • 13. Worst of allDirty state 100 CPAN modules are updated 1 failedCan’t easily revert
  • 14. retreatcp /usr/bin/perl${old} /usr/bin/perl old perl does not contain new site_lib
  • 15. But what ifUpgrade perl for... performance bug-fixes evaluation
  • 16. PracticalsModule authors have to correctlyspecify module dependencies.Module users have to run tests inorder to reveal runtime errors. assuming there are sufficient numbers of tests
  • 17.
  • 18. perlbrew A tool to installdifferent versions of perls
  • 19. admin-freeperl installation management
  • 20. beer-driven softwaredevelopment
  • 21. rvm1.8, 1.9, ree, jruby, rubinus, macruby, maglev, ironruby
  • 22. perlbrew5.8, 5.9, 5.10, 5.11, 5.12, 5.13, 5.14, 5.15
  • 23. Installation#1curl -kL http://xrl.us/perlbrewinstall | bash#2cpan -i App::perlbrewperlbrew init
  • 24. Usageperlbrew install perl-5.12.2perlbrew install perl-5.13.5perlbrew install perl-5.10.1perlbrew install perl-5.8.8 * Internet connection is required
  • 25. Usageperlbrew use perl-5.14.2perlbrew use perl-5.15.5perlbrew switch perl-5.14.2perlbrew off
  • 26. Usageperlbrew 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. Usageperlbrew lib
  • 29. Usageperlbrew lib listperlbrew lib create nobitaperlbrew lib create perl-5.14.2@nobitaperlbrew use perl-5.14.2@nobitaperlbrew lib delete perl-5.12.3@nobita
  • 30. cd ~/src/App-Awesomeperlbrew use perl-5.10.1@app-awesomeperlbrew use perl-5.14.2@app-awesomecd ~/src/Module-Awesomeperlbrew use perl-5.10.1@nobitaperlbrew use perl-5.14.1@nobitaperlbrew use perl-5.14.2@nobita
  • 31. perlbrew use perl-5.10.1@app-awesome
  • 32. perl installation nameperlbrew use perl-5.10.1@app-awesome
  • 33. local::lib nameperlbrew use perl-5.10.1@app-awesome
  • 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. Propertiesisolated perl installations bin, site_lib, local::libinstall a new version ≠ upgrade @INC does not include old site_lib
  • 39. Benefits`sudo cpan` is no moreeasier-to-clean perl environments Nuke the whole thing to clean the messNo old @INC
  • 40. Benefitsper-app isolated perl environmentssetup. avoid, in advance, any possible incompatible issues with other apps. know your libs
  • 41. Benefitsavoid lib conflicts with what you hadinstall older versions of moduleswithout worries to break other appcode. cpanm http://URL.TO/Mo-0.1.tar.gz App::pmuninstall
  • 42. RationaleDon’t mess up vendor perl too much.Learn new stuffs in the dev versionof perl. keep up with the fashion
  • 43. RationaleTest modules or apps ... with newer perl ... with older perl
  • 44. RationaleTest perl itself -Dusethreads -Duse64bitall -Duse64bitint Configure -h -D -U -A
  • 45. Rationalespare some guts B, XS Better with a perl built with DEBUGGING
  • 46. Thoughtsperlbrew « cpanm, ack, rvm
  • 47. ThoughtsOne standalone program embed non-core modules very easy distribution runs a tiny bit faster
  • 48. Thoughtsrvm bash programming master-piece developer-friendly experiences production uses
  • 49. Further ThoughtsDeprecate switch/use to external perlImprove multi-user scenarioMore related tool to help developeridentify module upgrade failure, andrevert to a good state.
  • 50. Further ThoughtsGood + Simple toolkitKeep new-comers by not frustratingthemGrow the community
  • 51. Simple is Hard
  • 52. Developmenthttp://github.com/gugod/App-perlbrew49 contributorsFeedback github issue / pull requests rt.cpan.org #perlbrew on twitter
  • 53. Developmenthttp://perlbrew.pl Documentation / Updates A static version of github Wiki
  • 54. Thank You