Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How do I get errors printing out to the browser?

by blue_cowdawg (Monsignor)
on Aug 05, 2003 at 15:51 UTC ( [id://281033]=note: print w/replies, xml ) Need Help??


in reply to How do I get errors printing out to the browser?

First off, you need to understand that if a Perl script fails perl -c then the server is only going to issue an internal error to your browser. Sorry! That's it! End of story!


Peter @ Berghold . Net

Sieze the cow! Bite the day!

Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.

Brewer of Belgian style Ales

  • Comment on Re: How do I get errors printing out to the browser?

Replies are listed 'Best First'.
Re: Re: How do I get errors printing out to the browser?
by jsprat (Curate) on Aug 05, 2003 at 16:43 UTC
    if a Perl script fails perl -c then the server is only going to issue an internal error to your browser.
    Why do you say that? fatalsToBrowser will report errors to the browser whether the script compiles or not. It even reports line numbers and paths, which is a good reason to remove fatalsToBrowser in production code.

      Just to verify what jsprat is saying:

      #!/usr/bin/perl -w use CGI ':standard'; use CGI::Carp qw(fatalsToBrowser); $i = 6; || $j = 7;
      produces:
      Content-type: text/html <H1>Software error:</H1> <PRE>syntax error at /tmp/t63 line 6, near &quot;; ||&quot; Execution of /tmp/t63 aborted due to compilation errors. </PRE> <P> For help, please send mail to this site's webmaster, giving this error + message and the time and date of the error. [Tue Aug 5 12:58:07 2003] t63: syntax error at /tmp/t63 line 6, near +"; ||" [Tue Aug 5 12:58:07 2003] t63: Execution of /tmp/t63 aborted due to c +ompilation errors.

      chriso: Do you see the same problems with this simple script, or does it display the error in the browser as you expect?

      OK.... maybe it is a case of YMMV and depends on the server and its configuration. I was able to verify what you are saying as true on my test apache server at home.

      However, in my professional experience what I said in my reply is also true with a lot of servers and server configurations.


      Peter @ Berghold . Net

      Sieze the cow! Bite the day!

      Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.

      Brewer of Belgian style Ales

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://281033]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-25 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found