[Bioperl-l] Philosophy, BioPerl Object Creation
Heikki Lehvaslaiho
heikki at ebi.ac.uk
Thu Mar 27 12:15:54 EST 2003
In related note: I wanted to inherit directly from a non-bioperl class
and merge it with the rest of bioperl and came up with this:
package Bio::WebAgent;
use vars qw(@ISA);
use strict;
use LWP::UserAgent;
use Bio::Root::Root;
@ISA = qw(LWP::UserAgent Bio::Root::Root);
sub new {
my $class = shift;
my $self = $class->SUPER::new();
while( @_ ) {
my $key = shift;
$key =~ s/^-//;
$self->$key(shift);
}
return $self; # success - we hope!
}
This actually faster than using _rearrange. In some of my tests old_new
versus new_new was 19:14 seconds, sometimes less.
Can anyone point out why this would be bad and perhaps show me a better
way of doing the same thing.
-Heikki
On Thu, 2003-03-27 at 11:32, Matthew Pocock wrote:
> > argument list intact. Also, parameters may be used
> > in more than one
> > level in the hierarchy.
> >
> > -hilmar
>
> That seems a little rude. Can we get around this a bit
> by accessing the parameter via an accessor? e.g.
>
> my $self = my_super->new(@_);
> // pigColor was an argument but I need to know it to
> // set myself up - use an accessor
> my $pigColor = $self->pigColor();
>
> Matthew
>
> > --
> >
> -------------------------------------------------------------
> > Hilmar Lapp email: lapp
> > at gnf.org
> > GNF, San Diego, Ca. 92121 phone:
> > +1-858-812-1757
> >
> -------------------------------------------------------------
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at bioperl.org
> > http://bioperl.org/mailman/listinfo/bioperl-l
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
--
______ _/ _/_____________________________________________________
_/ _/ http://www.ebi.ac.uk/mutations/
_/ _/ _/ Heikki Lehvaslaiho heikki at ebi.ac.uk
_/_/_/_/_/ EMBL Outstation, European Bioinformatics Institute
_/ _/ _/ Wellcome Trust Genome Campus, Hinxton
_/ _/ _/ Cambs. CB10 1SD, United Kingdom
_/ Phone: +44 (0)1223 494 644 FAX: +44 (0)1223 494 468
___ _/_/_/_/_/________________________________________________________
More information about the Bioperl-l
mailing list