http://www.perlmonks.org?node_id=159552


in reply to DBI script runs from command line, not from CGI

I don't see any exception handling in the DBI calls (prepare, execute). try adding something like:
$sth->execute($i, $data{$i}{cname}, $j, $data{$i}{ports}{$j}{service}, + $data{$i}{ports}{$j}{banner}) or die "Content-type: text/plain\n\n $ +DBI::errstr";
(the prepare is also an excellent candidate as well)

Replies are listed 'Best First'.
Re: Re: DBI script runs from command line, not from CGI
by tachyon (Chancellor) on Apr 16, 2002 at 16:46 UTC
    %attrib = ( RaiseError => 1, PrintError => 0 );

    When you add \%attrib to the end of the DBI->connect statement (as is done) errors are handled by a die automatically. It saves you writing error checking code for every statement.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print