Carton and Minilla

Jed Cunningham - Thousand Oaks Perl Mongers

June 15, 2016

Carton

Perl module dependency manager

What?

  • Declare dependencies in cpanfile
  • Ensure you use the same versions of modules across devs and/or environments

cpanfile

Use DateTime 1.17 from 2015


          requires 'DateTime', '==1.17';
          

            carton install
            ls -l
            vim cpanfile.snapshot
            
local
Modules are installed here
cpanfile.snapshot
The exact versions that were installed

Simple script (ex.pl)


            #!/usr/bin/env perl
            use warnings;
            use strict;

            use DateTime;
            use v5.24;

            say $DateTime::VERSION;
            

Lets run it


            chmod +x ex.pl
            carton exec ./ex.pl
            perl -Ilocal/lib/perl5 ex.pl
            

Ready for deployment?

Push code somewhere (minus local :)


            carton install --deployment
            

What about bundling? (Don't want to hit cpan when deploying)


            carton bundle
            

Bundles the necessary tarballs into vendor/cache

Install from bundled tarballs


            carton install --cached (--deployment)
            

Using both --cached and --deployment, you wont hit cpan

Alternatives

  • Carmel
  • Pinto
  • Stratopan (hosted Pinto)

Minilla

opinionated CPAN module authoring tool

Assumes your module(s):

  • Are Pure Perl and located in lib/
  • Executables are in script/ (if any)
  • Is maintained with Git
  • Has a static list of prerequisites described in cpanfile
  • Has a Changes file

Benefits

  • Install via git, cpanm git://...
  • Works out of the box
    • Generates README.md from POD
    • Makes tags
    • Populates contributors section

Cons

  • Not all that flexible
  • Minimal configuration
  • Doesn't declare all its dependencies

Alternatives

  • Dist::Milla (sister project by MIYAGAWA)
  • Dist::Zilla

Demo