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

Thanks, matija!

Is it possible to use 'warn' or a custom bail out subroutine there instead of 'use CGI::Carp qw(fatalsToBrowser);}?

  • Comment on Re: Re: Trap errors in entire module...

Replies are listed 'Best First'.
Re: Re: Re: Trap errors in entire module...
by matija (Priest) on Mar 28, 2004 at 09:45 UTC
    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.

      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; } }