go ahead... be a heretic | |
PerlMonks |
Re^4: getting 2 things done at once with Class::Base (return undef)by jplindstrom (Monsignor) |
on Nov 02, 2007 at 14:07 UTC ( [id://648650]=note: print w/replies, xml ) | Need Help?? |
It is indeed in PBP, but IMHO this is one of the less thought through practices. The example and problem described in the book applies to a specific situation, but the conclusion/solution is then elevated to a general practice.
The real lesson here is: if the sub is documented to return a scalar and it uses a return code to signal failure, it should return a scalar. It shouldn't randomly introduce context sensitivity in case of failure. /J
In Section
Meditations
|
|