in reply to Re: Re: Die function misfunctions
in thread Die function misfunctions

FYI, if you use
use CGI qw (:standard);
that's using CGI.pm in "function" mode, meaning there is no need to instantiate an object to use all the nifty CGI features. This is why print header; works. The "header" function gets imported from CGI into your program by the qw(:standard) bit in "use CGI." There are plenty of docs for this in the POD for CGI.pm.

The long and the short of it is: if you're using qw(:standard) don't bother using $query=new CGI. In fact, as I have discovered on a couple of occassions, doing so can even get you into trouble. :-(

But that's probably not your problem. Whenever you get Error 500 messages it means that your web browser is not getting what it expects, which means your CGI is not providing good, properly header'd information. If you have fatalstobrowser turned on and you're still getting the error it means your program isn't even compiling properly. (If it compiled, FatalsToBrowser would kick in and tell you what was wrong.) To check compilation do a perl -c yourscript.cgi from the command line to root out any nasty syntax errors.

Gary Blackburn
Trained Killer

Replies are listed 'Best First'.
Re: Re: Re: Re: Die function misfunctions
by lauragarcia (Acolyte) on Apr 30, 2001 at 22:35 UTC
    Reply to y'all (with my thanks!) You're right, the program has syntax errors and is not compiling correctly. Even so, what does seem to do nice error logging, however, is the
    BEGIN { use CGI::Carp qw(carpout); open(LOG, ">mycgi-log.txt") or die "Unable to append to mycgi-log: $! "; carpout(*LOG); }
    script, which is catching and printing my errors in the file and isn't too much trouble to consult. I just can't get the fatalstoBrowser to kick in.

    Also, thanks for confirming the possible conflict with the $object designation and the qw(:standard) syntax.

    laura.guimauve