Exception Handling
Ovid
publiustemp-londonpm at yahoo.com
Wed Jul 11 13:01:02 BST 2007
----- Original Message ----
From: Pete Sergeant <pete at clueball.com>
> I quite like using: methods always return a true value on success, and
> if they fail, you make a log, and return false yourself. Requires a very
> lightweight instantiator that always passes tho, and you do have to
> occasionally do nasty things like return empty arrayrefs.
And if the end-user forgets to check a return value, or checks it incorrectly (there are plenty of subtle ways this can happen), this returning false fails. I only want to see code returning false if the failure is safe to ignore. Otherwise, I want a proper exception.
Die early. Die often.
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Perl and CGI - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/
More information about the london.pm
mailing list