Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: CGI::Carp fatalsToFile

by Bod (Parson)
on Oct 06, 2021 at 16:25 UTC ( [id://11137269]=note: print w/replies, xml ) Need Help??


in reply to Re: CGI::Carp fatalsToFile
in thread CGI::Carp fatalsToFile

Thanks for the very helpful reply

You could try putting this at the top of the script:
use CGI::Carp qw(set_die_handler); BEGIN { sub handle_errors { my $msg = shift; print "Content-Type: text/html\n\n"; print "$msg"; } set_die_handler(\&handle_errors); }

I'm going to write some test code so that I can properly test what is going on. It will probably have to wait until the weekend though. But this code has been a little confused!

Is set_die_handler a method of CGI::Carp and set_die_handler(\&handle_errors); in the BEGIN block is overriding it?
Or is something different happening here?

Replies are listed 'Best First'.
Re^3: CGI::Carp fatalsToFile
by tangent (Parson) on Oct 06, 2021 at 17:34 UTC
    Is set_die_handler a method of CGI::Carp and set_die_handler(\&handle_errors); in the BEGIN block is overriding it?

    set_die_handler is a method of CGI::Carp, but its purpose is to allow you to specify your own function to be executed "any time a script calls "die", has a syntax error, or dies unexpectedly at runtime". See the docs for more.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-18 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found