perlbrew yapcasia 2010

53

description

This is my perlbrew talk slide for YAPC Asia 2010.

Transcript of perlbrew yapcasia 2010

Page 1: perlbrew yapcasia 2010
Page 2: perlbrew yapcasia 2010
Page 3: perlbrew yapcasia 2010

Perl

Kang-min Liu@gugod

Page 4: perlbrew yapcasia 2010

.meta

•twitter.com/gugod

•Perl / Javascript / Ruby programmer

•CPAN Author for ~100 distributions

•perlbrew

Page 5: perlbrew yapcasia 2010

perlbrew

Page 6: perlbrew yapcasia 2010

•A tool to install tons of perls

•switch between them

•build with customized options(-D -A -U)

•build from tarball or git

perlbrew

Page 7: perlbrew yapcasia 2010

Usage

perlbrew install perl-5.12.2perlbrew install perl-5.13.5

* Internet connection is required

Page 8: perlbrew yapcasia 2010

Usage

perlbrew install perl-5.10.1perlbrew install perl-5.8.8

* Internet connection is required

Page 9: perlbrew yapcasia 2010

Usage

# git checkoutcd ~/src/perlperlbrew install .

* Internet connection is not required

Page 10: perlbrew yapcasia 2010

Usage

perlbrew installed

Page 11: perlbrew yapcasia 2010

> 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

Page 12: perlbrew yapcasia 2010

Usage

perlbrew switch perl-5.12.2

# Disable perlbrewperlbrew off

Page 13: perlbrew yapcasia 2010

Installation

curl −LO http://xrl.us/perlbrewchmod +x perlbrew./perlbrew install

Page 14: perlbrew yapcasia 2010

Installation

curl -L http://xrl.us/perlbrewinstall | bash

new

Page 15: perlbrew yapcasia 2010

Installation

cpan -i App::perlbrew

* Not recommended

Page 16: perlbrew yapcasia 2010

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

Page 17: perlbrew yapcasia 2010

Benefits

•Easier-to-clean perl environments

•Nuke the whole thing to clean the mess

•Old @INC does not accumulate with old perls

Page 18: perlbrew yapcasia 2010

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.

Page 19: perlbrew yapcasia 2010

Why?

•Don’t mess up vendor perl too much.

•Learn new stuffs in the dev version of perl.

•keep up with the fashion

Page 20: perlbrew yapcasia 2010

Why?

•Test modules or apps

• ... with newer perl

• ... with older perl

Page 21: perlbrew yapcasia 2010

Why?

•Test perl itself

•Threaded perl

•64bit perl

•performance

•smokebrew

Page 22: perlbrew yapcasia 2010

Why?

•Play dark magic kitchen fire

•Devel::Declare, B::*, XS

•Better with a perl built with DEBUGING

Page 23: perlbrew yapcasia 2010

development

•github.com/gugod/App-perlbrew

•so many pull requests

•20 contributors

•send me pull requests any time!

Page 24: perlbrew yapcasia 2010

development

•better bash integration / experiments

•easy site_lib management (clone / bundle / nuke)

•Steal some goodies from Devel::PPPort

Page 25: perlbrew yapcasia 2010

Page 26: perlbrew yapcasia 2010

← perlbrew

•/usr/local/bin/perl/opt/local/bin/perl/home/gugod/local/bin/perl

•site_lib is preserved after upgrade

Page 27: perlbrew yapcasia 2010

← perlbrew

•perl is so backward compatible

• Ideal for developing and production

•keep upgrading perl is generally OK

Page 28: perlbrew yapcasia 2010

← perlbrew

•Upgrading CPAN modules isn’t necessarily OK.

•Errors happens at runtime, when it’s not binary-compatible.

•Developers must correctly specify module dependencies.

Page 29: perlbrew yapcasia 2010

← perlbrew

• In CPAN Distribution you do that in Makefile.PL / META.yml

•Same tool for App

Page 30: perlbrew yapcasia 2010

Simple is Hard

•support for legacy code and decisions.

•perl, cpan

•cpanm, perlbrew: new tools for the current fashion

Page 31: perlbrew yapcasia 2010

Thoughts

perlbrew « cpanm, rvm

Page 32: perlbrew yapcasia 2010

Thoughts

•Standalone program

•embed non-core modules

•very easy distribution

•runs a tiny bit faster

Page 33: perlbrew yapcasia 2010

Thoughts

•« rvm

•bash programming master-piece

•developer-friendly experiences

•production server

Page 34: perlbrew yapcasia 2010

Further Thoughts• Test::Continuous

• perlbrew

• local::lib

• App::local::lib::helper

• cpanm

• cpan-outdated

• cpansearch

Page 35: perlbrew yapcasia 2010

rapidly improves somethinga little bit better

Page 36: perlbrew yapcasia 2010

rapidly improves somethinga little bit better ❤

Page 37: perlbrew yapcasia 2010

Hates

Page 38: perlbrew yapcasia 2010

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

Page 39: perlbrew yapcasia 2010

Less Hateful

•bundle cpan dists with your distribution

•PAR / Shipwright / %INC hack

•Avoid long dependency list

Page 40: perlbrew yapcasia 2010

•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

Page 41: perlbrew yapcasia 2010

cpan install can run 90% faster...

Page 42: perlbrew yapcasia 2010

cpan install can run 90% faster...

By skiping all tests,

Page 43: perlbrew yapcasia 2010

Less Hateful

•To skip for tests safely, consult cpantester.org first

•A cpan/cpanm plugin shall be written to automates that.

Page 44: perlbrew yapcasia 2010

Less Hateful

•Solving long dependency list problem is a no-op

• if cpan installation is super fast

• like < 1 second / module

Page 45: perlbrew yapcasia 2010

天下武功唯快不破

Fast fists cannot be broken

Page 46: perlbrew yapcasia 2010

side projects

Page 47: perlbrew yapcasia 2010

• cpan-sets: local::lib switcher wrote in

• « rvm gemset, bundler

• App::local::lib::helper

• experimental project

• per-app bundle

cpan-sets

Page 48: perlbrew yapcasia 2010

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

Page 49: perlbrew yapcasia 2010

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)

Page 51: perlbrew yapcasia 2010

Conclusion

•github social coding actually works!

•Easy distributing is important.

•Simple is hard.

•Fast is better then slow.

Page 52: perlbrew yapcasia 2010

•Good + Simple + Easy toolkit

•Keep new-comers by not frustrating them

•Grow the community

Page 53: perlbrew yapcasia 2010

Thank You