Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: DBI script runs from command line, not from CGI

by wardk (Deacon)
on Apr 16, 2002 at 16:25 UTC ( #159552=note: print w/ replies, xml ) Need Help??


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)


Comment on Re: DBI script runs from command line, not from CGI
Download Code
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://159552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2014-09-18 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (125 votes), past polls