Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I agree with samtregar's post, as long as the behavior is documented.

    In general, with my recent modules I've been trying to adopt a consistent behavior of "die on mutation, die on bad params, return false on accessor".

    In other words, if you try to mutate/construct an object in an illegal way, it throws an exception. If a method takes parameters and you pass invalid parameters, it dies. If you try to simply retrieve some information that isn't available, it returns false.

    This is, IMHO, a pretty sensible way to do things. If you try to do something impossible, it dies. If you pass in bad data, it dies. These are both _exceptional_ conditions, and merit a big reaction. OTOH, if you simply ask for data that can't be provided, I figure it's up to you to check the return value and handle the "no data" case however you see fit.