Deploying Perl Applications with Carton

Short Form


Carton is Bundler for Perl. It allows installing a consistent set of modules local to an application. We use it to deploy large Perl applications


CPAN has lots of useful Perl modules and it makes it easy to install them. But it has the problem of how you specify the modules your application needs to install, how you replicate the install on different machines, and how you keep applications and system packages separate.

Carton is built on top of Cpanminus and local::lib. Cpanminus is a simple command-line tool for installing CPAN modules. local::lib helps install modules into an application directory. It uses a new file format, Cpanfile, to define the module deepencies, including version specification. It records the installed versions so the specific sets of modules can be recreated on other machines and is checked into version control.

We use Carton to install modules for our large Perl applications. It allows developers to install modules without installing system administrators. Since installing modules can be slow, we implemented caching on top of Carton. We deploy applications with Capistrano and have integrated Carton into our build and deployment process.

Speaking experience

I've spoken at local user groups and for company training.