in reply to Croak, return et al.
Here's a recent thread with a very similar question and helpful replies: Using die() in methods
APIs where methods return a false value to indicate error are very common in Perl and many other languages, leaving the error handling up to the user. In this case, I might base my decision on how often you expect the error condition to occur - if often, then return;, if not, then die.
Note that your use of $@ is not completely reliable; what would be better is eval { $splat->splat(); 1 } or next; (see e.g. "Background" in Try::Tiny).
|
|---|