[cgiapp] CGIApp + FastCGI
frioux at gmail.com
Tue Jun 16 13:53:55 EDT 2009
On Tue, Jun 16, 2009 at 12:26 PM, Jeff MacDonald <jeff at interchange.ca>wrote:
> If anyone can point me in a direction that would be helpful.
>> You almost certainly are carrying data over from one request to the
>> next, and with multiple processes running the one that services
>> request number N+1 might not be the same one that served request
>> number N, so you might not have the data that you expect.
>> The challenge of being neat and clean between requests exists for both
>> mod_perl and fastcgi. It's touched on briefly here:
>> and if you search the site (from the search box on the front page) for
>> fastcgi and/or mod_perl, you'll see a couple of more references.
>> From the Notes secition of the CGI::Application::FastCGI man page:
>> Note that cgiapp_init() will be called only once under lifecycle of
>> FastCGI. setup() will also only be called once. (you should not be
>> doing magical things in 'setup'.) So if you want to do something
>> for every REQUESTS, you should write the logic in cgiapp_prerun().
> I ended up going with the ModPerl::Registry route. So far it seems to be
> working quite well.
> Now, I just have to figure out how to print an alternative Header type , so
> my cgi can spit out PDF and excel files at users. :)
> Thanks folks. Your direction helped.
If you are using mod_perl it's really easy if you set up a
CGI::Application::Dispatch and then set up apache like this:
use lib 'path/to/lib';
Then you should be able to set headers the regular cgiapp way.
More information about the cgiapp