May 17, 2015
Perl
Kang-min Liu@gugod
.meta
•twitter.com/gugod
•Perl / Javascript / Ruby programmer
•CPAN Author for ~100 distributions
•perlbrew
perlbrew
•A tool to install tons of perls
•switch between them
•build with customized options(-D -A -U)
•build from tarball or git
perlbrew
Usage
perlbrew install perl-5.12.2perlbrew install perl-5.13.5
* Internet connection is required
Usage
perlbrew install perl-5.10.1perlbrew install perl-5.8.8
* Internet connection is required
Usage
# git checkoutcd ~/src/perlperlbrew install .
* Internet connection is not required
Usage
perlbrew installed
> perlbrew installedperl-5.10.0perl-5.10.1perl-5.11.1perl-5.11.5perl-5.12.0perl-5.12.0-RC0perl-5.12.0-RC3perl-5.12.1perl-5.12.2(*)perl-5.13.0perl-5.13.2perl-5.13.4perl-v5.11.5-15-gd3b0eb1/Users/gugod/perl5/perlbrew/bin/perl/Users/gugod/perl5/perlbrew/perls/current/bin/perl/usr/bin/perl
Usage
perlbrew switch perl-5.12.2
# Disable perlbrewperlbrew off
Installation
curl −LO http://xrl.us/perlbrewchmod +x perlbrew./perlbrew install
Installation
cpan -i App::perlbrew
* Not recommended
Properties
•does not require sudo
•perl installation are isolated
•site_lib, bin, lib
• install a new version ≠ upgrade
•@INC does not include old site_lib
Benefits
•Easier-to-clean perl environments
•Nuke the whole thing to clean the mess
•Old @INC does not accumulate with old perls
Benefits•per-app isolated perl environments
setup.
•avoid, in advance, any possible incompatible issues with other apps.
•know your site_libs
• ‘sudo cpan’ is no more.
Why?
•Don’t mess up vendor perl too much.
•Learn new stuffs in the dev version of perl.
•keep up with the fashion
Why?
•Test modules or apps
• ... with newer perl
• ... with older perl
Why?
•Test perl itself
•Threaded perl
•64bit perl
•performance
•smokebrew
Why?
•Play dark magic kitchen fire
•Devel::Declare, B::*, XS
•Better with a perl built with DEBUGING
development
•github.com/gugod/App-perlbrew
•so many pull requests
•20 contributors
•send me pull requests any time!
development
•better bash integration / experiments
•easy site_lib management (clone / bundle / nuke)
•Steal some goodies from Devel::PPPort
←
← perlbrew
•/usr/local/bin/perl/opt/local/bin/perl/home/gugod/local/bin/perl
•site_lib is preserved after upgrade
← perlbrew
•perl is so backward compatible
• Ideal for developing and production
•keep upgrading perl is generally OK
← perlbrew
•Upgrading CPAN modules isn’t necessarily OK.
•Errors happens at runtime, when it’s not binary-compatible.
•Developers must correctly specify module dependencies.
← perlbrew
• In CPAN Distribution you do that in Makefile.PL / META.yml
•Same tool for App
Simple is Hard
•support for legacy code and decisions.
•perl, cpan
•cpanm, perlbrew: new tools for the current fashion
Thoughts
perlbrew « cpanm, rvm
Thoughts
•Standalone program
•embed non-core modules
•very easy distribution
•runs a tiny bit faster
Thoughts
•« rvm
•bash programming master-piece
•developer-friendly experiences
•production server
Further Thoughts• Test::Continuous
• perlbrew
• local::lib
• App::local::lib::helper
• cpanm
• cpan-outdated
• cpansearch
rapidly improves somethinga little bit better
rapidly improves somethinga little bit better ❤
Hates
Hates•CPAN dependency list for
$framework is too long
•CPAN $modules takes too long to install / tests takes very long time to finish
•$software is too fat (eats too much memory space) and slow
Less Hateful
•bundle cpan dists with your distribution
•PAR / Shipwright / %INC hack
•Avoid long dependency list
•smaller, single-purpose
• less memory consumption
• less sub-commands to be memorized
• less memory consumption in your brain
•easier to maintain / be faster
Less Hateful
cpan install can run 90% faster...
cpan install can run 90% faster...
By skiping all tests,
Less Hateful
•To skip for tests safely, consult cpantester.org first
•A cpan/cpanm plugin shall be written to automates that.
Less Hateful
•Solving long dependency list problem is a no-op
• if cpan installation is super fast
• like < 1 second / module
天下武功唯快不破
Fast fists cannot be broken
side projects
• cpan-sets: local::lib switcher wrote in
• « rvm gemset, bundler
• App::local::lib::helper
• experimental project
• per-app bundle
cpan-sets
cpanfile# Install with: cpanm < cpanfilehttp://github.com/bestpractical/jifty-dbi/tarball/masterhttp://github.com/bestpractical/jifty/tarball/masterhttp://github.com/bestpractical/jifty-plugin-openidB::Hooks::EndOfScopeDateTimeDigest::SHA1Email::AddressExporter::LiteHTML::EntitiesJiftyX::MarkaplJiftyX::ModelHelpersMarkaplRegexp::CommonRegexp::Common::Email::AddressString::BufferStackSub::InstallText::Markdown::DiscountText::MultiMarkdownUNIVERSAL::requirecommon::sense
perlrocks• rubygems counter-part.
• multi-version module install
• use perlrocks;
# perl5 syntax of ‘use’use Foo-1.3;
• site_lib/rocks/Foo-1.3/lib/Foo.pm
• Installation tool (rock)
side projects
• github.com/gugod/App-perlbrew
• github.com/gugod/cpan-sets
• github.com/gugod/perlrocks
Conclusion
•github social coding actually works!
•Easy distributing is important.
•Simple is hard.
•Fast is better then slow.
∞
•Good + Simple + Easy toolkit
•Keep new-comers by not frustrating them
•Grow the community
Thank You