[Catalyst] ->model-> return values?

Roderick A. Anderson raanders at acm.org
Mon Sep 25 16:04:32 CEST 2006

Matt S Trout wrote:
> Roderick A. Anderson wrote:
>>I'm 'looked-out'  Been searching and reading for the last two hours with 
>>no good results.
>>A pointer/suggestion/clue-stick would be appreciated.
>>Do I need to wrap a
>>	$c->model( 'TheModel' )->update( ... )
>>	$c->model( 'TheModel' )->delete( ... )
>>in an eval block to check for success or failure or ( hope, hope, hope ) 
>>can I just test the return value?
> Assuming you're using DBIx::Class, it depens what you mean by success or 
> failure - do you mean success as in "updated/deleted something" or as in "ran 
> the appropriate query successfully" ?

Sorry it seemed so clear in my mind.  :-)

Yes using DBIx::Class.

If the update or delete succeeded in updating or deleting; not just running.

So if an update query should fail because NULL got passed to a NOT NULL 
field, a letter got into an INT field, etc. or an delete fails because 
the key doesn't exist.  I'm looking to determine if the update or delete 
succeeds then do one thing if it fails then another.


More information about the Catalyst mailing list