View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Tatsuhiko Miyagawa > carton-v0.9.67-TRIAL > Carton



Annotate this POD


View/Report Bugs
Module Version: 0.9.67   Source  


Carton - Perl module dependency manager (aka Bundler for Perl)


  # On your development environment
  > cat cpanfile
  requires 'Plack', 0.9980;
  requires 'Starman', 0.2000;

  > carton install
  > git add cpanfile cpanfile.snapshot
  > git commit -m "add Plack and Starman"

  # Other developer's machine, or on a deployment box
  > carton install
  > carton exec starman -p 8080 myapp.psgi


This software is under heavy development and considered ALPHA quality till its version hits v1.0.0. Things might be broken, not all features have been implemented, and APIs are likely to change. YOU HAVE BEEN WARNED.


carton is a command line tool to track the Perl module dependencies for your Perl application. The managed dependencies are tracked in a cpanfile.snapshot file, which is meant to be version controlled, and the snapshot file allows other developers of your application will have the exact same versions of the modules.


Initializing the environment

carton will use the .carton directory for local configuration and the local directory to install modules into. You're recommended to exclude these directories from the version control system.

  > echo .carton/ >> .gitignore
  > echo local/ >> .gitignore
  > git add cpanfile.snapshot
  > git commit -m "Start using carton"

Tracking the dependencies

You can manage the dependencies of your application via cpanfile.

  # cpanfile
  requires 'Plack', 0.9980;
  requires 'Starman', 0.2000;

And then you can install these dependencies via:

  > carton install

The modules are installed into your local directory, and the dependencies tree and version information are analyzed and saved into cpanfile.snapshot in your directory.

Make sure you add cpanfile.snapshot to your version controlled repository and commit changes as you update dependencies. This will ensure that other developers on your app, as well as your deployment environment, use exactly the same versions of the modules you just installed.

  > git add cpanfile cpanfile.snapshot
  > git commit -m "Added Plack and Starman"

Deploying your application

Once you've done installing all the dependencies, you can push your application directory to a remote machine (excluding local and .carton) and run the following command:

  > carton install

This will look at the cpanfile.snapshot and install the exact same versions of the dependencies into local, and now your application is ready to run.

Bundling modules

carton can bundle all the tarballs for your dependencies into a directory so that you can even install dependencies that are not available on CPAN, such as internal distribution aka DarkPAN.

  > carton bundle

will bundle these tarballs into vendor/cache directory, and

  > carton install --cached

will install modules using this local cache. This way you can avoid querying for a database like CPAN Meta DB or CPAN mirrors upon deployment time.


Code repository, Wiki and Issue Tracker


IRC chat room


Tatsuhiko Miyagawa


Tatsuhiko Miyagawa 2011-


This software is licensed under the same terms as Perl itself.








syntax highlighting: