in reply to Re: Re: Trap errors in entire module...
in thread Trap errors in entire module...

Naturally: there is nothing magical about CGI::Carp after all: look at it's code, and you'll see how it does it's work.

Once you understand it, there should be no problem adapting it to your needs.

Replies are listed 'Best First'.
Re: Re: Re: Re: Trap errors in entire module...
by kiat (Vicar) on Mar 28, 2004 at 10:16 UTC
    Hey matija,

    I'm trying to have something like the following in place of CGI::Carp but it doesn't work. What's the correct way to do it?

    BEGIN { if ($@) { # This print html error code will go into a sub within # the main script. It's here for illustration purposes. print qqContent-type: text/html\n\n~; print qq~<html>\n~; print qq~<head>\n~; print qq~<title>Error</title>\n~; print qq~</head>\n~; print qq~<body>\n~; print qq~A fatal error has occurred blah blah...\n~; print qq~</body>\n~; print qq~</html>~; exit; } }