Bioperl: Reading from a stream into Bio::Seq

Matthew Pocock
Tue, 27 Oct 1998 17:50:45 +0000


Ewan Birney wrote:
> We would be *alot* better off if we could have some higher level language/
> documentation control about precisely what fields were in the objects.
> (hohohohoho...OOP perl...makes you laugh sometimes).

I have quite a solid way of creating perl objects, with all the
functionality wrapped up in a base class. It gives you freebies
1) generates functions to access member variables, and package variables
  from an interface definition. You can say things like
   %fields = (scalar=>1, array=>[], hash=>{})
  and get objects with three members that are a scalar, an array ref
  and a hash ref. Also has automatic delegation support.
2) compile time checks to ensure that you don't inherit the same field
  from multiple super-classes
3) comiple time checks to ensure that you have disambiguated all methods
  that are inherited from more than one parent.
4) runtime error-messages when methods can't be found. a) prints a
  shortlist of all legal methods that are similar to the missing
  e.g. -  you invoke 'toFie' and it will find 'toFile'. b) prints out
  a list of all legal methods (including those inherited) and the
  package variables etc....
5) strong introspection support. $obj->scalars returns all scalars in
  the package $obj is blessed into, $obj->functions returns all unctions
  etc etc etc
6)  Automatically handles combining multiple parent objects into a
  single new object, and initialization of all the member fields of new

It has revolutionized how I write perl objects. You don't have to think
about all those member variable access functions, or writing the same
code 10 times to delegate some functions to a member variable. Also,
adding access functions to your package variables makes them act like
static class members. That means that if you use a derived package, it
inherits the ability to get/set the static class members into it's
interface. And, as it doesn't use AUTOLOAD, you can use the debugger to
find out what is going on, and use AUTOLOAD for other things.

Anyway, if you are interested, I will send in the module.

> Ewan Birney
> <>
> =========== Bioperl Project Mailing List Message Footer =======
> Project URL:
> For info about how to (un)subscribe, where messages are archived, etc:
> ====================================================================

Joon: You're out of your tree
Sam:  It wasn't my tree
                                                 (Benny & Joon)
=========== Bioperl Project Mailing List Message Footer =======
Project URL:
For info about how to (un)subscribe, where messages are archived, etc: