Yeah, you're right.  T definitely IMTOWTDI.  Using RaiseError is a valid 
choice, as is checking each call for errors.  However, you do need one or the 
other.  Calling a method on a undefined variable is rarely one of TWTDI.

________________________________

From: Rutherdale, Will [mailto:[EMAIL PROTECTED]
Sent: Thu 6/22/2006 6:22 PM
To: [email protected]
Subject: Always Die (was: RE: Getting spatial data?)



Just to expand on that piece of the discussion, there are cases where I
don't use 'die' on DBI statements at all.

For instance, I may have a system script (not for end users) whose
purpose is to do some database update operations and either succeed or
fail.  If it succeeds then it does the whole job correctly, if it fails
then it makes no changes and returns an error code.  The specific errors
in the failure case will show up in the log, and everything will be
rolled back.

For that purpose I will open the DBI connection with these options
(amongst others):  { PrintError => 1, RaiseError => 1, AutoCommit => 0
}.

As Larry says, there is more than one way to do it, and for some
purposes you can use this as a consistent and clean error handling
policy without the explicit 'die' on every statement.

-Will


> -----Original Message-----
> From: Garrett, Philip (MAN-Corporate)
> [mailto:[EMAIL PROTECTED]
> Sent: Thursday 22 June 2006 14:08
> To: [email protected]
> Subject: RE: Getting spatial data?
>
> Just nit picking here, but don't forget "|| die $connect->errstr"
> after your prepare statement.


     - - - - - Appended by Scientific Atlanta, a Cisco company - - - - -
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is 
solely intended for the named addressee (or a person responsible for delivering 
it to the addressee). If you are not the intended recipient of this message, 
you are not authorized to read, print, retain, copy or disseminate this message 
or any part of it. If you have received this e-mail in error, please notify the 
sender immediately by return e-mail and delete it from your computer.



Reply via email to