in reply to See errors in CGI scripts using perl
As jeffa points out use CGI::Carp and look in the server's log files for the errors. Additionally you can use CGI::Carp qw/ fatalsToBrowser / if you don't have access to the server's log files.
Other techniques you can use involve some sort of trapping of errors and sending them out as html. An example:
#!/usr/bin/perl -w #################################3 use strict; use CGI; use DBI; my $q=new CGI; my $dbh=DBI->connect("DBI:mysql:dbhost=localhost", "dbuser","secret") or scream_and_die($q,$DBI::errstr); # # more code... # exit(0); sub scream_and_die { my ($q,$str)=@_; print $q->header,$q->start_html(-title=>"UH-OH!"), $q->p("An error occured!"), $q->p($str),$q->end_html; exit(0); }
The biggest problem with the example I give above is that if you use it in production you possibly can leak sensitive information if something bad happens.
| Peter L. Berghold | Brewer of Belgian Ales |
| Peter@Berghold.Net | www.berghold.net |
| Unix Professional | |
|
|---|