cpanfile

 cpanfile

cpanfile is yet another format to declare CPAN dependencies of your Perl application.

B2d653d5d663e750a2cd57bfbc9b727f?s=128

Tatsuhiko Miyagawa

November 15, 2011
Tweet

Transcript

  1. cpanfile Tatsuhiko Miyagawa London Perl Workshop 2011 Tuesday, November 15,

    2011
  2. Hey, cpanminus is so Hot! Tuesday, November 15, 2011

  3. Hey, cpanminus is so Hot! Tuesday, November 15, 2011

  4. Making a Perl module that depends on CPAN modules Tuesday,

    November 15, 2011
  5. = Making a CPAN distribution Tuesday, November 15, 2011

  6. Declaring CPAN Dependencies Tuesday, November 15, 2011

  7. Makefile.PL Build.PL Tuesday, November 15, 2011

  8. use  ExtUtils::MakeMaker; WriteMakefile(    NAME  =>  ‘MyModule’,    VERSION  =>

     ‘1.22’,    PREREQ_PM  =>  {        ‘JSON’  =>  0,        ‘Hash::MultiValue’  =>  ‘0.11’,    }, ); Tuesday, November 15, 2011
  9. use  Module::Build; my  $build  =  Module::Build-­‐>new(    module_name  =>  ‘MyModule’,

       requires  =>  {        ‘JSON’  =>  ‘2.00’,        ‘Hash::MultiValie’  =>  ‘0.20’,    }, ); $build-­‐>create_build_script; Tuesday, November 15, 2011
  10. use  inc::Module::Install; name  ‘MyApp’; all_from  ‘lib/MyApp.pm’; requires  ‘JSON’,  ‘2.00’; requires

     ‘Hash::MultiValue’  =>  0.10; WriteAll; Tuesday, November 15, 2011
  11. Or use Dist::Zilla. Tuesday, November 15, 2011

  12. Making a Perl application that depends on CPAN modules Tuesday,

    November 15, 2011
  13. ≠ Making a CPAN distribution Tuesday, November 15, 2011

  14. Declaring CPAN Dependencies Tuesday, November 15, 2011

  15. ? Tuesday, November 15, 2011

  16. Makefile.PL Build.PL Tuesday, November 15, 2011

  17. Problems with Makefile.PL/Build.PL Tuesday, November 15, 2011

  18. Lots of boilerplate Tuesday, November 15, 2011

  19. use  ExtUtils::MakeMaker; WriteMakefile(    NAME  =>  ‘MyModule’,    VERSION  =>

     ‘1.22’,    PREREQ_PM  =>  {        ‘JSON’  =>  0,        ‘Hash::MultiValue’  =>  ‘0.11’,    }, ); Tuesday, November 15, 2011
  20. use  Module::Build; my  $build  =  Module::Build-­‐>new(    module_name  =>  ‘MyModule’,

       requires  =>  {        ‘JSON’  =>  ‘2.00’,        ‘Hash::MultiValie’  =>  ‘0.20’,    }, ); $build-­‐>create_build_script; Tuesday, November 15, 2011
  21. use  inc::Module::Install; name  ‘MyApp’; all_from  ‘lib/MyApp.pm’; requires  ‘JSON’,  ‘2.00’; requires

     ‘Hash::MultiValue’  =>  0.10; WriteAll; Tuesday, November 15, 2011
  22. dzil has no boilerplate ... but it’s not a distribution!

    Tuesday, November 15, 2011
  23. Can have deps configure_requires, META.yml inc/Module/Install.pm Tuesday, November 15, 2011

  24. Makefile.PL Build.PL Tuesday, November 15, 2011

  25. configure build test install Tuesday, November 15, 2011

  26. configure build test install ✔ Tuesday, November 15, 2011

  27. My application is not meant to be installed! e.g. dotcloud

    push Tuesday, November 15, 2011
  28. Great for dists. Not-so for apps. Tuesday, November 15, 2011

  29. By the way... Tuesday, November 15, 2011

  30. I <3 Module::Install’s DSL Tuesday, November 15, 2011

  31. CPAN Meta Spec v2 Awesome stuff. Tuesday, November 15, 2011

  32. Tuesday, November 15, 2011

  33. Marrying them together? Tuesday, November 15, 2011

  34. A Proposal Tuesday, November 15, 2011

  35. cpanfile Tuesday, November 15, 2011

  36. requires  ‘Plack’,  0.9980; requires  ‘Catalyst’,  ‘>=  5.8,  <  5.9’; conflicts

     ‘MooseX::Foo’,  ‘<  0.10’; on  ‘test’  =>  sub  {        requires  ‘Test::More’,  0.80; }; on  ‘develop’  =>  sub  {        requires  ‘Devel::NYTProf’; }; Tuesday, November 15, 2011
  37. inspired by: gemfile(5) Tuesday, November 15, 2011

  38. Backward compatible to: Module::Install(::DSL) Tuesday, November 15, 2011

  39. Convertible to: CPAN::Meta::Prereqs Tuesday, November 15, 2011

  40. requires  ‘Plack’,  0.9980; requires  ‘Catalyst’,  ‘>=  5.8,  <  5.9’; conflicts

     ‘MooseX::Foo’,  ‘<  0.10’; on  ‘test’  =>  sub  {        requires  ‘Test::More’,  0.80; }; on  ‘develop’  =>  sub  {        requires  ‘Devel::NYTProf’; }; Tuesday, November 15, 2011
  41. CPAN::Meta::Prereqs-­‐>new({    runtime  =>  {        requires  =>

     {            ‘Plack’  =>  0.9980,            ‘Catalyst’  =>  ‘>=  5.8,  <  5.9’,        },        conflicts  =>  {            ‘MooseX::Foo’  =>  ‘<  0.10’,        },    },    test  =>  {        requires  =>  {            ‘Test::More’  =>  0.80,        },    },    develop  =>  {        requires  =>  {            ‘Devel::NYTProf’  =>  0,        },    } }); Tuesday, November 15, 2011
  42. Will be supported by: cpanm 1.6, carton 1.0 Tuesday, November

    15, 2011
  43. Carton github.com/miyagawa/carton Tuesday, November 15, 2011

  44. Apps first, Dists later. Tuesday, November 15, 2011

  45. Turing Complete? PPI, B::*, Safe Validated by authoring tools Tuesday,

    November 15, 2011
  46. github.com/miyagawa/cpanfile Tuesday, November 15, 2011

  47. Thanks! http://speakerdeck.com/u/miyagawa Tuesday, November 15, 2011