On Wed, 16 Jul 2003, Iain Truskett wrote:
> What do people think parsers should return if they can't
> parse? And what if they do parse, but DateTime doesn't want
> to create an object of the appropriate specification?
>
> Should we wrap our methods in evals and return undef?
>
> Should we just throw errors?
I'm a big fan of throwing errors, since it forces the callers to actually
handle them. Just returning undef leads to this:
my $dt = $parser->parse('this is not a date');
do_something_with_date($dt);
and then mysterious failures later on.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/