Catalyst Advent - Day 6 - Building PAR Packages

NOTE: This article was written in 2005. For more up-to-date information on deplyoment, please see

You know the problem, you got a application perfectly running on your development box, but then *shudder* you have to quickly move it to another one for demonstration/deployment/testing...

PAR packages can save you from a lot of trouble here. They are usual Zip files that contain a blib tree, you can even include all prereqs and a perl interpreter by setting a few flags!

Follow these few points to try it out!

1. Install Catalyst 5.61 (or later) and PAR 0.89

    % perl -MCPAN -e 'install Catalyst'
    % perl -MCPAN -e 'install PAR'

2. Create a application

    % MyApp
    % cd MyApp

3. Add these lines to Makefile.PL (below "catalyst_files();")

    catalyst_par_core();   # Include modules that are also included
                           # in the standard Perl distribution,
                           # this is optional but highly suggested

    catalyst_par();        # Generate a PAR as soon as the blib
                           # directory is ready

4. Prepare the Makefile, test your app, create a PAR (the two Makefile.PL calls are no typo)

    % perl Makefile.PL
    % make test
    % perl Makefile.PL

Future versions of Catalyst (5.62 and newer) will use a similar but more elegant calling convention.

    % perl Makefile.PL
    % make catalyst_par

Congratulations! Your package "myapp.par" is ready, the following steps are just optional.

5. Test your PAR package with "parl" (no typo) :)

    % parl myapp.par
        [parl] myapp[.par] [script] [arguments]

        parl myapp.par -r

      Available scripts:

    % parl myapp.par
    You can connect to your server at http://localhost:3000

Yes, this nifty little starter application gets automatically included. You can also use "catalyst_par_script('')" to set a default script to execute.

6. Want to create a binary that includes the Perl interpreter? No problem!

    % pp -o myapp myapp.par
    % ./myapp
    You can connect to your server at http://localhost:3000

Have fun!

-- sri