logik has asked for the wisdom of the Perl Monks concerning the following question:

Before upgrading my CGI.pm via CPAN, CGI::Carp used to print compilation errors straight out in my browser. Now it reports only my dies, confessions, etc... after the script has been parsed and compiled. Where should i look to get the previous comportement ? Is there a setting i should use ? here is my usual includes :
#!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser);

Replies are listed 'Best First'.
Re: CGI Carp
by PodMaster (Abbot) on Feb 06, 2003 at 10:16 UTC
    What version did you have before you upgraded?

    Have you checked the changelog?
    http://search.cpan.org/author/LDS/CGI.pm-2.89/CGI/Carp.pm
    http://search.cpan.org/src/LDS/CGI.pm-2.89/cgi_docs.html

    use CGI::Carp qw(fatalsToBrowser set_message); BEGIN { sub handle_errors { my $msg = shift; print "<h1>Oh gosh</h1>"; print "<p>Got an error: $msg</p>"; } set_message(\&handle_errors); } In order to correctly intercept compile-time errors, you should call s +et_message() from within a BEGIN{} block.
    I vaguely, vaguely, vaguely recall this working a long time ago, but it doesn't appear to be currently ;)(time for a bug report i'd say)


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Previous CGI.pm version was 2.56, now it is 2.89. But I don't want to modify *all* my scripts to make compile errors appear by adding a set_message! i want to change just one thing (in CGI.pm for example)... Gosh i hate this 'Server Error'! PS: i'm parsing the changelog... Thanks!
      Apparently, the code you pointed out (calling set_message) doesn't catch syntax and compile-time errors... Still, it seems CGI::Carp doesnt print the Content-type header...