[Catalyst] ->model-> return values?

John Napiorkowski jjn1056 at yahoo.com
Mon Sep 25 16:30:37 CEST 2006



--- Chisel Wright <chisel at herlpacker.co.uk> wrote:

> On Mon, Sep 25, 2006 at 07:04:32AM -0700, Roderick
> A. Anderson wrote:
> > 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.
> 
> Run it (in a transaction) in an eval{} block, then
> check $@?

eval is how I do it as well, although there might be a
more advanced way of doing this.

It probably goes without saying that you should try
really hard to validate the incoming data, not just to
make sure the format is correct (an integer field is a
number, etc) but that you check the database restricts
as well for things like uniqueness, etc.  You can use
data::formvalidator to write custom validator
callbacks for things like that.  Just making sure the
email looks like an email isn't enough.

--john


> 
> -- 
> Chisel Wright
> e: chisel at herlpacker.co.uk
> w: http://www.herlpacker.co.uk/
> 
> This is not an automated signature. I type this in
> to the bottom of every
> message. 
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Catalyst mailing list