Reverse Complement utility, Bio::Alg, return value problem
Steven E. Brenner
brenner@hyper.stanford.edu
Fri, 8 Aug 1997 18:05:12 -0700 (PDT)
> > Maybe the old return value idea (suggested by SteveC), combined with
> > carps and croaks (depending upon severity) is the best approach. This, of
> > course, means that one can't do the sort of repeated operations which
> > would be desirable and which are possible if the self object is returned.
>
> Returning an object would still be possible if the code which expects
> this behavior is properly wrapped in an eval block. When I consider what
> I've been doing, I'm closer to emulating croak than carp for most of the
> exception handling I do. In effect, I'm doing an object-specific croak:
> an object is disabled and the script doesn't crash. The object can then
> be querried about why it is disabled and how it became so. The problem is
> that there is no way to enforce that an object gets querried. Croaking
> would force the issue.
>
> So I am now more in favor of croak. I think it would encourage the
> creation of more fault-tolerant code and it would help maintenance since
> potential trouble spots would be flagged by an eval block.
>
Right -- I agree with all of the above. The problem is that wrapping an
eval block around EVERY possible problem is quite tedious. It is possible
that often the object will be "mostly ok" if you just muddle on.
For most "casual" Perl code this is probably good enough. It is only on
production quality code that the errors really need to be dealt with.
Since most of the code will probably be used for casual rather than
production work, I question if requiring production level exception
handling is a good idea.
Steve