Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: DBI, rows, and do

by trammell (Priest)
on Jun 06, 2005 at 01:59 UTC ( [id://463812]=note: print w/replies, xml ) Need Help??


in reply to DBI, rows, and do

The line(s)
$dbh = DBI->connect(...) || die "DB connect failed: " . $dbh->errstr;
won't print anything useful upon failing to create $dbh, since you can't in this case call a method on an object whose construction failed. You probably want something more like:
$dbh = DBI->connect(...) || die "DB connect failed: ", DBI->errstr;
Update: jZed++!

Replies are listed 'Best First'.
Re^2: DBI, rows, and do
by jZed (Prior) on Jun 06, 2005 at 02:11 UTC
    You're right in general, but in this case yours wouldn't do anything either :-). Since the OP included RaiseError=>1 in the connect statement, the connect, if it fails, will print the errstr and die before it reaches the or part of the statement.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found