On September 4, 2002 at 22:13, Gunnar Hjalmarsson wrote: > > You may want to have a test operation for you CGI program that checks > > that things will work properly. For example, the program blindly does: > > > > require 'mhamain.pl'; > > ... > > In general, I > > would wrap the main block for the CGI program in an eval block so > > any die()'s are caught. > > Principally I agree, but an easier way to achieve the same thing is to > explicitly add a few die statements and: > > use CGI::Carp 'fatalsToBrowser'; > > I wrote the script for my own use, but since I mention it on this list > from time to time, I guess I should clean up the code, including > preventing "Internal Server Error" messages on the screen...
Using the blanket "use CGI::Carp 'fatalsToBrowser';" may not be desirable since it could reveal system and/or configuration information you may not want to be exposed if the CGI program can be accessed without restriction. An alternative is to have your own log file. Then you can examine it via ftp. You can do your own log file by wrapping that main code block in an eval to capture any die messages and/or register __DIE__ and __WARN__ handlers (which is what CGI::Carp does) to send the messages to your log file. You may also want to open STDERR to the log file for cases where output is send directly to STDERR. I'd test this first to see if closing STDERR that the web server provides may cause some problems with the web server (which it should not, but you never know). --ewh --------------------------------------------------------------------- To sign-off this list, send email to [EMAIL PROTECTED] with the message text UNSUBSCRIBE MHONARC-USERS
