The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


App::BundleDeps - Bundle All Your Module Deps In A local::lib Dir


    use App::BundleDeps;

    App::BundleDeps->new()->bundle_from_meta( 'META.yml' );

    # or

    my @modules = ( $module1, $module2, $module3, ... );
    App::BundleDeps->new()->bundle_modules( @modules );


App::BundleDeps is a tool that allows you to "bundle" all your prerequisites in one local::lib installation. This is very useful when you want to deploy your application.


Here, I'm going to show how to deploy a Catalyst application using App::BundleDeps and daemontools.

So, suppose you checked out / downloaded your production ready application here:


Move to that directory, and create your bundle:

    cd /home/apps/MyApp-0.89
    perl Makefile.PL NO_META=0
    perl -MApp::BundleDeps -e 'App::BundleDeps->new->bundle_from_meta("META.yml");'

You obviously have to have Makefile.PL setup so that it includes all the necessary prerequisites.

At this point you should have a directory named extlib. Now prep your daemontools environemnt like so: First create the necessary directory structure (do it where svscan isn't watching)

    mkdir /var/lib/svscan/MyApp-0.89

Now move to that directory, and create a run script file. We'll assume we're deploying a fastcgi server:

    PERL=/usr/local/bin/perl # I like to explicitly declare this, YMMV

    # XXX - You may have to specify MYAPP_HOME/MYAPP_CONFIG
    exec setuidgid app \
        $PERL \
        -Mlocal::lib=$MYAPP_DIR/extlib \
        $MAYPP_DIR/script/ \
        -e \
        -l /path/to/socket \

You should probably set up run script for logging, but see the daemontools manual for that.

Now, create a symlink to where svscan is watching, typically /service or /etc/service:

    ln -s /var/lib/svscan/MyApp-0.89 /service/MyApp-0.89

And your service should start.

This is especially useful, because when you come up with MyApp-0.90, you can simply follow the same steps and deploy MyApp-0.90 with its own set of prerequisites (you don't have to care what MyApp-0.89 was using, or what the system installed module versions are!). When you checked that MyApp-0.90 is receiving the requests, just follow the following steps to unstage your previous app:

    rm /service/MyApp-0.89
    svc -dx /var/lib/svscan/MyApp-0.89
    svc -dx /var/lib/svscan/MyApp-0.89/log

Woohoo, done!


Prerequisites marked as "recommends" are not installed
Tests will not be run


Daisuke Maki - <>

Miyagawa Tatsuhiko did the actual useful bits.


This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.