[Israel.pm] Exception Handling

Yuval Yaari yuval at windax.com
Mon Apr 19 02:43:49 PDT 2004


Hi,

I basically want to trap errors in a way that it would be easier for me 
to check.
@Errors doesn't work for me anymore :)
Also that's not global across my Apache handlers and some of my 
packages/Class::DBI packages.
I've looked at Error.pm and Exception::Class - but not in depth.

I basically want to call a function that verifies the form values that a 
user submitted and stores them in a database.
So in such situation I have a few types of errors, what just comes to my 
mind at the moment:
- DB errors (duplicate key, invalid query, the number of arguments 
didn't match the number of placeholders...)
- Form errors (username cannot contain numeric digits, or whatever)
- I usually have some internal errors (user does not have permissions to 
do XYZ)

I want to do this in a way that looks good, easy to maintain, and of 
course - easy to trap the cause of the error - and act according to that 
(e.g: I don't want the user to know that I screwed up with counting 
placeholders, but I do want him to know that his username isn't valid).

I'm sure you guys have been using the abovementioned tools, or similar 
tools/tricks, and could help me.
Examples could really help me figure out what method fits me best - so 
please send some :p


  Thanks,
  --Yuval




More information about the Perl mailing list