in reply to What module do you like for debugging CGI scripts

I usually use CGI::Carp qw(fatalsToBrowser) to trap errors so I can see them. I use sudo tail -f /var/log/http-errors.log to watch for my warnings. If there's something better, I'd like to know about it also.

-Paul

  • Comment on Re: What module do you like for debugging CGI scripts

Replies are listed 'Best First'.
Re^2: What module do you like for debugging CGI scripts
by metaperl (Curate) on Jan 27, 2007 at 15:51 UTC
    I took a look at CGI::Carp and it does not support the ability to specify the level of log msg that you want output. I also don't see a way to switch off logging altogether when in a production environment.

      You don't want to turn off the logging altogether in a production environment, merely not to send the output to the browser. CGI::Carp will, by default, send the output to stderr, hence to the server log, which you do want in a production environment.

      The following snippet should help:

      BEGIN { my $carp_arg; if ($ENV{ENV} =~ /DEV/) { # or some other test for a non producti +on env $carp_arg = 'fatalsToBrowser'; } use CGI::Carp $carp_arg; }

      --

      Oh Lord, won’t you burn me a Knoppix CD ?
      My friends all rate Windows, I must disagree.
      Your powers of persuasion will set them all free,
      So oh Lord, won’t you burn me a Knoppix CD ?
      (Missquoting Janis Joplin)

      Surely there are no bugs in the code you're running on your production environment ;)

      Also, if you have  if $DEBUG attached to the end of all your calls to warn then they'll just disappear when you set $DEBUG=undef

      @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;
      Just don't load the module in production, though you may want to adjust your web server (apache) to show better pages on 500 code errors.

      just another cpan module author