[Bioperl-l] $_ assignment question

Josh Lauricha laurichj at bioinfo.ucr.edu
Thu Jul 31 19:36:03 EDT 2003


On Thu  16:08, Paul Edlefsen wrote:
> My understanding has been that Bio::SeqIO->new(..) will surely use the 
> correct method, while new Bio::SeqIO might use the new(..) method from 
> the class that the code appears in, which would be incorrect.  Have I 
> misunderstood the issue?
> 

You may be entirely correct, however I've always been under the
impression they are interchangable. If they aren't, what would be an
example of the wrong function being called? The only thing I can figure
is where someone is calling a function from another package which has
been declared (or exported) in that scope... for instance...

package MyExample;
use Bio::PrimarySeq;

sub new {
    my($class) = @_;
    bless my $self = {}, $class;

    $self->{seq} = new Bio::PrimarySeq;
    # might this call be confused as MyExample->new(Bio::PrimarySeq);
    # but I think Bio::PrimarySeq being a bare word prevents that...
    # so maybe this:
    $self->{seq} = new 'Bio::PrimarySeq';
    # but thats wrong and shouldn't be protected against.
    ...
    return $self;
 }

Note that i am ONLY talking about new().

> +-----O------------------------------------+
> |    o-o     Paul T. Edlefsen
> |    o---o   Computational Biologist
> |  o----o    mailto:paul at systemsbiology.org
> | O----O     Institute for Systems Biology
> | 0--o       1441 North 34th Street
> |   O        Seattle, Washington 98103-8904
> |  o-o       callto:1-206-732-1336
> +-o---o------------------------------------+

cool sig

-- 

----------------------------
| Josh Lauricha            |
| laurichj at bioinfo.ucr.edu |
| Bioinformatics, UCR      |
|--------------------------|


More information about the Bioperl-l mailing list