[Dbix-class] Re: Catching DBI errors, without eval?

Josef Karthauser joe at tao.org.uk
Sun Nov 12 23:47:05 GMT 2006


On Sun, Nov 12, 2006 at 05:43:59PM -0500, Christopher H. Laco wrote:
> > 
> > What I'd like to do is call
> > 
> >     $object->delete
> > 
> > and have it return a success or failure status.  I'm surprised that
> > nobody appears to require this kind of behaviour.
> 
> What version are you on?
> The upcoming 0.08 release (or -current from svn) has exception_action(),
> which allow onw to direct exceptions to another sub for processing.
> 

Version 0.07002.

> In previous versions, you could also set the HandleError option in the
> connection information, or even set it on the active dbh:
> 
> > $schema_instance->storage->dbh->{HandleError} = sub process_error();
> 

Great.  This is helpful.  Thanks.

Joe
-- 
Josef Karthauser (joe at tao.org.uk)	       http://www.josef-k.net/
Physics Particle Theory (student)   http://www.pact.cpes.sussex.ac.uk/
================ An eclectic mix of fact and theory. =================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://jules.scsys.co.uk/pipermail/dbix-class/attachments/20061112/891d0da2/attachment.pgp


More information about the Dbix-class mailing list