in reply to Re9: Learning how to use the Error module by example
in thread Learning how to use the Error module by example
But why is this better than the version using return? (and we don't care between no-stored and not-found :-). Why are returns bad?
We just seem to be adding three more exception classes, moving the logic of what we care and don't care about handling from the mainline to the catch block, and making the caller handle exceptions when they're just interested in a boolean value. How is this simpler? All the callers of find are now going to have to do:
eval { $self->find($foo) }; print "found" if ( UNIVERSAL::isa($@, 'Signal::Search::Found') ); die $@ unless UNIVERSAL::isa($@, 'Signal::Search'); # rather than print "found" if $self->find($foo);
which seems insane - but ignoring that point what is wrong with the return? That's the bit I'm not getting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^10: Learning how to use the Error module by example
by dragonchild (Archbishop) on Jul 30, 2003 at 15:38 UTC | |
by adrianh (Chancellor) on Jul 30, 2003 at 15:49 UTC |