Catalyst Advent - Day 6 - Building PAR Packages
NOTE: This article was written in 2005. For more up-to-date information on deplyoment, please see http://dev.catalyst.perl.org/wiki/deployment
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
% catalyst.pl 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 Usage: [parl] myapp[.par] [script] [arguments] Examples: parl myapp.par myapp_server.pl -r myapp myapp_cgi.pl Available scripts: myapp_cgi.pl myapp_create.pl myapp_fastcgi.pl myapp_server.pl myapp_test.pl % parl myapp.par myapp_server.pl 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('myapp_server.pl')" 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 myapp_server.pl You can connect to your server at http://localhost:3000