theAcolyte has asked for the wisdom of the Perl Monks concerning the following question:
To make sure I'm not simply insane, I ran the same script under MacPerl and it output the HTML formatted page I expected from Carp.
When calling an error directly, like die "something here"; carp(fatalsToBrowser) works as I expect it to on the solaris box. Its warnings to browser also seems to work properly. The only thing that does not output to the browser is syntax errors.
I've tried it with just the toBrowser exported, with other .pm's included and without; with CGI::Carp in a BEGIN block and not. None of these things seem to make a difference.
Here's the code I'm using to test CGI::Carp's behavior:
If i put in the closing curly (the syntax error) it executes properly (its in the code above) and sends the warnings I'd expect. If I remove the closing curlie I get a generic "Internal Server Error" on solaris, but under Macperl I get the following:#!/usr/local/bin/perl -w BEGIN { use CGI::Carp qw(fatalsToBrowser warningsToBrowser); } #die "This is a fatal error"; $first = "Hello"; #This should produce a warning print "Content-Type: text/html\n\n"; warningsToBrowser(1); print "<HTML><BODY>"; print "Its a beautiful day in the neighborhood,"; print "a beautiful day in the neighborhood...<BR>"; # Add a syntax error. if($second == "Hello") { print "How are ya\n"; } print "</BODY></HTML>";
Which is what I'd expect from CGI::Carp.# syntax error, near ") print" File 'Calvin:Cleanup At Startup:2852655'; Line 19 # Unmatched right bracket, at end of line File 'Calvin:Cleanup At Startup:2852655'; Line 19 Content-type: text/html <H1>Software error:</H1> <CODE># Execution of Calvin:Cleanup At Startup:2852655 aborted due to +compilation errors. <\/CODE> <P> Please send mail to this site's webmaster for help. # [Thu May 22 01:36:50 2003] Calvin:Cleanup At Startup:2852655: # Exec +ution of Calvin:Cleanup At Startup:2852655 aborted due to compilation + errors.
So ... does anyone have ANY idea why CGI::Carp would misbehave this way? Its the most recent version (I tried reinsalling with perl -MCPAN -e 'shell', and eventually forced it to reinstall) and it seems to be functioning partially.
Finally, I also checked the normal error logs to see if CGI::Carps output was appering there; it was not.
Any help or adivce appreciated.
Erik
edit jeffa - escape inner closing code tag
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: CGI::Carp Doesnt seem to work properly
by jeffa (Bishop) on May 22, 2003 at 07:49 UTC | |
by theAcolyte (Pilgrim) on May 22, 2003 at 08:31 UTC | |
|
Re: CGI::Carp Doesnt seem to work properly
by submersible_toaster (Chaplain) on May 22, 2003 at 07:50 UTC | |
by theAcolyte (Pilgrim) on May 22, 2003 at 08:22 UTC | |
|
Re: CGI::Carp Doesnt seem to work properly
by rinceWind (Monsignor) on May 22, 2003 at 16:13 UTC | |
|
(jeffa) Re: CGI::Carp Doesnt seem to work properly
by jeffa (Bishop) on May 22, 2003 at 23:23 UTC | |
by theAcolyte (Pilgrim) on May 24, 2003 at 21:44 UTC | |
|
Re: CGI::Carp Doesnt seem to work properly
by tye (Sage) on May 22, 2003 at 18:40 UTC |