I am developing a Perl script using FastCGI (using CGI::Fast
and CGI::Carp 'fatalsToBrowser')
.
When my script has compile errors, it causes the browser to hang. It seems that fatalsToBrowser
is not working the way it does with normal CGI (just send the compile errors to the browser). How can I fix this?
I'm the CGI.pm maintainer. I would recommend avoiding using 'fatalsToBrowser' in this case. Some Perl frameworks over features which do the same thing. For example, with CGI::Application there is CGI::Application::Plugin::DebugScreen. Other frameworks have something similar.
In other cases, the popular 'Carp' and 'CGI::Carp' modules can conflict if they both end up imported in the same name space, because they both provide functions with the same names, like 'carp' and 'croak'. I recommend using Carp and avoiding CGI::Carp.
I can not offer you a workaround but only an explanation, FastCGI works completely differently. When a CGI application is executed standard descriptors and environ is provided before execution, in a FastCGI application the server (application) must first accept a connection from the client (usually webserver) and exchange a few messages/records before a request is accepted and response can be sent. CGI::Carp does it's magic during perl's compile phase and assumes that standard descriptors is available when the syntax error occurs (compile phase) and that is to early for CGI::Fast.pm.
I'm one of the maintainers of FCGI.pm(and libfcgi) so I'll work with the CGI maintainers to get this resolved.
-
Thanks... can you also look at this: stackoverflow.com/questions/6013354/… – JoelFan Apr 11 '12 at 22:52