in reply to mod_perl question
The same way you should have been writing it from the start ;D proper scoping and careful usage of globals ;)
See Practical mod_perl: 2.6.1. Porting Existing CGI Scripts to mod_perl
See also CGI to mod_perl Porting. mod_perl Coding guidelines
perhaps I am misunderstanding the use of handlers, or the configuration of mod_perl. What I would like to avoid is an entry in httpd.conf for every page (and this is where I think I might be misunderstanding something.).
Yes. Before mod_perl, I might start a program with a nice template (commentary on this template) like so:
After mod_perl all I need for a handler is to rename MyProgram.pl to MyProgram.pm, and rename Main to handler#!/usr/bin/perl -- use strict; use warnings; use CGI; Main(@ARGV); exit(0); sub Main { ... # CGI program here }
Now, I might also use CGI::Application or Catalyst, so sub handler would consist ofpackage MyProgram; sub handler { CGI::initialize_globals(); # unneeded if using CGI->new ... # CGI program here }
orMyApp->new->run;
Catalyst::ScriptRunner->run('MyApp', 'Apache');
|
|---|