This is how
Catalyst's chained dispatch works (q.v.
Catalyst::DispatchType::Chained). I always thought it was just sane.
As for assertions, I read a blog post recently where the author asserted that sane code generally had less else-clauses than otherwise. I've been looking at my code in that light and the code I find to be better has that property. I have a lot of unless-blocks of the form:
sub foo {
my $self = shift;
my %args = @_;
# Lots of these
unless ( ... ) {
return;
}
# Do the real thing
}
Same thing, right?
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?