Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Carmel at YAPC::EU 2015

Carmel at YAPC::EU 2015

Tatsuhiko Miyagawa

September 03, 2015
Tweet

More Decks by Tatsuhiko Miyagawa

Other Decks in Technology

Transcript

  1. Takeaway • CPAN dependencies = Your app • Describe it

    • Manage it • Version Control it
  2. cpanfile • DSL to describe CPAN dependencies • Version Range,

    Phases • a la Gemfile • Module::CPANfile • Supported by many tools (cpanm)
  3. requires  'Plack',  '1.001';   requires  'Mojolicious',  '==  6.17';   on

     'develop'  =>  sub  {      requires  'Devel::NYTProf';   };   on  'test'  =>  sub  {      requires  'Test::More';      requires  'Test::mysql';   };
  4. requires  'Plack',  '1.001';   requires  'Mojolicious',  '==  6.17';   on

     'develop'  =>  sub  {      requires  'Devel::NYTProf';   };   on  'test'  =>  sub  {      requires  'Test::More';      requires  'Test::mysql';   };
  5. requires  'Plack',  '1.001';   requires  'Mojolicious',  '==  6.17';   on

     'develop'  =>  sub  {      requires  'Devel::NYTProf';   };   on  'test'  =>  sub  {      requires  'Test::More';      requires  'Test::mysql';   };
  6. cpanm + cpanfile • Grabs latest versions that satisfy ranges

    • '== version' can pin versions • cpanmetadb/MetaCPAN SPOF
  7. Carton + cpanfile • Installs into ./local • Creates cpanfile.snapshot

    • Git friendly • carton  install  -­‐-­‐deployment
  8.  @local>  carton  install   Installed  Poles-­‐1.0.tar.gz   @remote>  carton  install

     -­‐-­‐deployment   Installed  Poles-­‐1.0.tar.gz
  9. Carton • Slow for large installs • Relies on cpanm

    internals • Git support is hard • Update/Rollback is unreliable • -­‐-­‐deployment is confusing • carton  exec doesn't check on development
  10. Carmel • Same UI/UX with Carton • Different internals •

    Rewritten from scratch • Deeper understandings of how Bundler works • Fast and Reliable
  11. How to build a CPAN module • Configure • Build

    • Test (Optional) • Install
  12. How to build a CPAN module • perl  Makefile.PL  

    • make   • make  test   • make  install
  13. ➜  perl  Makefile.PL     Checking  if  your  kit  is

     complete...   Looks  good   Generating  a  Unix-­‐style  Makefile   Writing  Makefile  for  Try::Tiny   Writing  MYMETA.yml  and  MYMETA.json   ➜  make   cp  lib/Try/Tiny.pm  blib/lib/Try/Tiny.pm   Manifying  1  pod  document  
  14. ➜  perl  Makefile.PL     Checking  if  your  kit  is

     complete...   Looks  good   Generating  a  Unix-­‐style  Makefile   Writing  Makefile  for  Try::Tiny   Writing  MYMETA.yml  and  MYMETA.json   ➜  make   cp  lib/Try/Tiny.pm  blib/lib/Try/Tiny.pm   Manifying  1  pod  document  
  15. The idea • Builds all modules without installing them •

    Manages these "blib"s (call them artifacts) • Chooses artifact paths dynamically on dev • Freezes artifact paths statically on prod
  16. Carmel Written in a few hours as a hack. Turned

    into a module at Berlin QA Hackathon.
  17. Commands • carmel install • carmel list/tree • carmel exec

    • carmel package • carmel rollout • carmel inject <Module>
  18. Current status • pre-1.0 • Usable (I use it on

    cpanmetadb production) • Snapshot support in development
  19. cpanm • Loved by the users • Mixed feelings by

    the developer (me) • God class, Hard to refactor • Grown out of a pre-fatpack single script • Not extensible
  20. Menlo • Modular, Scriptable, Object-Oriented APIs • Plugin Hooks •

    uses CPAN::Common::* • Extracts the common bits (e.g. HTTP::Tinyish) • Still bootstrappable with fatpack/vendoring
  21. FAQ • Why Carmel/Menlo? • 1.0/2.0 ETA? • Is Carton

    deprecated? • What's the purple thing in your avatar?