Bioperl: State of the art in perl Exception modules?

Stephen A. Chervitz sac@neomorphic.com (Steve A. Chervitz)
Wed, 17 Nov 1999 22:04:37 -0800 (PST)


Ewan Birney writes:
 > On Mon, 15 Nov 1999, Mr P.A. Van Heusden wrote:
 > 
 > > 
 > > Hi Ewan
 > > 
 > > I've now been playing with BioPerl exceptions for a while (as I convert my
 > > code into children of Bio::Root::Object), and they seem to work well (I
 > > like the debugging output they give when not caught). As you say, though,
 > 
 > sorry for teh delay in replying..
 > 
 > 
 > > it is pretty much an all or nothing case. 
 > > 
 > > There are essentially, as I see it, two ways forward for refining this:
 > > 
 > > 1) Standardize on an 'exception string' like:
 > > 
 > >  $self->throw('IO ERROR: blah blah');
 > > 
 > > or
 > > 
 > > 2) Allow for exception classes - so
 > > 
 > >  $self->throw('IOERROR', 'blah blah');
 > > 
 > > The tendency in exception schemes I've seen seems to be to use the second.
 > > Would it be worthwhile working on this for BioPerl?
 > 
 > Yes - I think it would. At the same time we could think about clearing up
 > the root object and discarding crud (A good thing in my view). Why
 > don't you make a proposal on guts about how it should work etc.

Exception subclasses sound fine with me, except I would put an
exception instance in the throw call itself. With the current
Bio::Root::Object, you can pass in an Err object as in:

$self->throw(new IOError(-msg=>"blah blah"));

I've only used this syntax for transfering an error from one object to 
another, to allow for re-throwing of errors, as in:
$self->throw($object->err)) but it should also work with Err
subclasses as above.

As for removing "crud", there are likely some experimental methods in
it that aren't used anywhere in Bioperl and it would be okay with me
to remove them. But first, we need to agree on what is crud and what
isn't. There may be other code out there that is dependent on the
crud. 

SteveC
sac@neomorphic.com

 > > 
 > > Peter
 > > --
 > > Peter van Heusden : pvanheus@hgmp.mrc.ac.uk : PGP key available
 > > Criticism has torn up the imaginary flowers from the chain not so that man
 > > shall wear the unadorned, bleak chain but so that he will shake off the 
 > > chain and pluck the living flower. - Karl Marx 
 > >            NOTE: I do not speak for the HGMP or the MRC.
 > > 
 > > =========== Bioperl Project Mailing List Message Footer =======
 > > Project URL: http://bio.perl.org/
 > > For info about how to (un)subscribe, where messages are archived, etc:
 > > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
 > > ====================================================================
 > > 
 > 
 > -----------------------------------------------------------------
 > Ewan Birney. Work: +44 (0)1223 494992. Mobile: +44 (0)7970 151230
 > <birney@sanger.ac.uk>
 > http://www.sanger.ac.uk/Users/birney/
 > -----------------------------------------------------------------
 > 
 > =========== Bioperl Project Mailing List Message Footer =======
 > Project URL: http://bio.perl.org/
 > For info about how to (un)subscribe, where messages are archived, etc:
 > http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
 > ====================================================================
=========== Bioperl Project Mailing List Message Footer =======
Project URL: http://bio.perl.org/
For info about how to (un)subscribe, where messages are archived, etc:
http://www.techfak.uni-bielefeld.de/bcd/Perl/Bio/vsns-bcd-perl.html
====================================================================