Slide 1

Slide 1 text

What's new in Carton & cpanm Tatsuhiko Miyagawa YAPC::Asia 2013 Keio University Saturday, September 21, 13

Slide 2

Slide 2 text

Me • Tatsuhiko Miyagawa • Lives in San Francisco • {github,twitter,CPAN}/miyagawa Saturday, September 21, 13

Slide 3

Slide 3 text

Saturday, September 21, 13

Slide 4

Slide 4 text

speakerdeck.com /miyagawa Saturday, September 21, 13

Slide 5

Slide 5 text

Agenda • cpanm 1.6 / 1.7 • Carton 1.0 • What's Next Saturday, September 21, 13

Slide 6

Slide 6 text

cpanminus tiny, standalone CPAN installer that "just works" Saturday, September 21, 13

Slide 7

Slide 7 text

vs. other installers Sane defaults. Quiet output. Fast and lightweight. One file install. Saturday, September 21, 13

Slide 8

Slide 8 text

%  curl  -­‐L  cpanmin.us  \ |  perl  -­‐  App::cpanminus Saturday, September 21, 13

Slide 9

Slide 9 text

♥ perlbrew, plenv Saturday, September 21, 13

Slide 10

Slide 10 text

cpanm 1.6 released in 2/26 Saturday, September 21, 13

Slide 11

Slide 11 text

Pinning versions Flexible version query Saturday, September 21, 13

Slide 12

Slide 12 text

>  cpanm  [email protected] >  cpanm  Plack~">=  1.0,  <  2.0" Saturday, September 21, 13

Slide 13

Slide 13 text

♥ MetaCPAN Saturday, September 21, 13

Slide 14

Slide 14 text

--dev Saturday, September 21, 13

Slide 15

Slide 15 text

install via git Saturday, September 21, 13

Slide 16

Slide 16 text

>  cpanm  git://github.com/plack/Plack.git@devel Saturday, September 21, 13

Slide 17

Slide 17 text

cpanfile support Saturday, September 21, 13

Slide 18

Slide 18 text

>  cat  cpanfile requires  'Plack',  '1.0000'; >  cpanm  -­‐-­‐installdeps  . Saturday, September 21, 13

Slide 19

Slide 19 text

cpanm 1.7 9/4, 2013 Saturday, September 21, 13

Slide 20

Slide 20 text

Major changes • Smaller executable size: 350KB -> 230KB • ♥ Travis CI • Better prerequisite spec support • Build Args support • Uninstall Saturday, September 21, 13

Slide 21

Slide 21 text

Saturday, September 21, 13

Slide 22

Slide 22 text

# cpanfile on develop => sub { requires 'Test::Pod'; recommends 'Devel::NYTProf'; }; > cpanm --installdeps . \ --with-develop \ --with-recommends Saturday, September 21, 13

Slide 23

Slide 23 text

# cpanfile feature 'sqlite' => sub { requires 'DBD::SQLite' recommends 'DBI', 3.1; }; > cpanm --installdeps . \ --with-feature=sqlite Saturday, September 21, 13

Slide 24

Slide 24 text

# travis.yml install: cpanm -nq --installdeps \ --with-develop --with-recommends Saturday, September 21, 13

Slide 25

Slide 25 text

cpanm DBD::mysql \ --configure-args="--with-mysql=/usr/local/ mysql" Saturday, September 21, 13

Slide 26

Slide 26 text

cpanm --uninstall DBI cpanm -U DBI Saturday, September 21, 13

Slide 27

Slide 27 text

github.com/ miyagawa/cpanminus Saturday, September 21, 13

Slide 28

Slide 28 text

Carton Bundler for Perl Saturday, September 21, 13

Slide 29

Slide 29 text

Managing CPAN Dependencies Saturday, September 21, 13

Slide 30

Slide 30 text

Why you need it Saturday, September 21, 13

Slide 31

Slide 31 text

(snip) http://yapcasia.org/2011/talk/91 Saturday, September 21, 13

Slide 32

Slide 32 text

“Upgrading CPAN modules broke my app” Saturday, September 21, 13

Slide 33

Slide 33 text

Dependencies are part of your app. Saturday, September 21, 13

Slide 34

Slide 34 text

cpanfile + cpanm • Simple • Yet powerful and flexible way to describe dependencies and version requirements • Version control cpanfile Saturday, September 21, 13

Slide 35

Slide 35 text

# cpanfile requires 'Plack', '== 1.0001'; requires 'DBI', '== 3.2'; ... Saturday, September 21, 13

Slide 36

Slide 36 text

caveats • Locking each dependency with specific version is tedious work • Can only lock direct dependencies • MetaCPAN as SPOF • No easy/reliable way to fallback Saturday, September 21, 13

Slide 37

Slide 37 text

Carton Saturday, September 21, 13

Slide 38

Slide 38 text

Basic idea: Describe CPAN dependencies snapshot tarball pathnames Saturday, September 21, 13

Slide 39

Slide 39 text

Built on top of: cpanfile + cpanm 1.6 Saturday, September 21, 13

Slide 40

Slide 40 text

carton 1.0 released in 8/4 Saturday, September 21, 13

Slide 41

Slide 41 text

What's new in 1.0 • No Makefile.PL/Build.PL support (cpanfile) • cpanfile.snapshot (no carton.lock) • 20x faster tree command • More reliable version extraction • carton update, carton bundle • fatpack executable for bootstrap Saturday, September 21, 13

Slide 42

Slide 42 text

DEMO Saturday, September 21, 13

Slide 43

Slide 43 text

gum.co/BmXz Saturday, September 21, 13

Slide 44

Slide 44 text

Deployment with Carton Saturday, September 21, 13

Slide 45

Slide 45 text

 @local>  carton  install  @local>  git  commit  cpanfile.snapshot  @local>  git  push @remote>  carton  install  -­‐-­‐deployment @remote>  carton  exec  plackup  ... Saturday, September 21, 13

Slide 46

Slide 46 text

Example: github.com/miyagawa/cpanmetadb-perl capistrano, Server::Starter, carton, plackup (twiggy) Saturday, September 21, 13

Slide 47

Slide 47 text

PaaS/Cloud github.com/miyagawa/heroku-buildpack-perl Saturday, September 21, 13

Slide 48

Slide 48 text

Saturday, September 21, 13

Slide 49

Slide 49 text

http://weblog.bulknews.net Saturday, September 21, 13

Slide 50

Slide 50 text

Support to come! Dokku, DotCloud, Travis CI, Cloud Foundry etc. Saturday, September 21, 13

Slide 51

Slide 51 text

github.com/miyagawa/carton irc.perl.org #carton Saturday, September 21, 13

Slide 52

Slide 52 text

Sneak Preview Saturday, September 21, 13

Slide 53

Slide 53 text

cpanm 1.8 cpanfile 1.1 Carton 1.1 Saturday, September 21, 13

Slide 54

Slide 54 text

BETA Saturday, September 21, 13

Slide 55

Slide 55 text

cpanm 1.8 git (+ any URL) support in index Saturday, September 21, 13

Slide 56

Slide 56 text

cpanfile 1.1 git syntax support Saturday, September 21, 13

Slide 57

Slide 57 text

requires  'Plack',  '1.0000',    git  =>  'git://github.com/plack/Plack.git',    ref  =>  'devel'; carton 1.1 Saturday, September 21, 13

Slide 58

Slide 58 text

requires  'Plack',  '1.0011',    dist  =>  'MIYAGAWA/Plack-­‐1.0011.tar.gz'; carton 1.1 Saturday, September 21, 13

Slide 59

Slide 59 text

requires  'Plack',  '1.0011',    dist  =>  'http://darkpan/Plack-­‐1.tar.gz'; carton 1.1 Saturday, September 21, 13

Slide 60

Slide 60 text

(demo) Saturday, September 21, 13

Slide 61

Slide 61 text

cpanm 1.8 • Rewrite internals • Backend API • Plugin support • CPAN Testers support (via plugins) Saturday, September 21, 13

Slide 62

Slide 62 text

carton 1.1 • configure args/hints support • safe exec on development • remember options (--path etc.) Saturday, September 21, 13

Slide 63

Slide 63 text

Thank you! Saturday, September 21, 13

Slide 64

Slide 64 text

speakerdeck.com /miyagawa Saturday, September 21, 13