[Bioperl-l] Bioperl objects and subroutines

Jonathan Manning bmb9jrm at bmb.leeds.ac.uk
Wed May 12 11:10:59 EDT 2004


Thanks to all on this- I was clearly barking up the wrong tree! But
everything seems to be working now.

Cheers,

Jon 

On Wed, 2004-05-12 at 15:55, Andreas Kahari wrote:
> On Wed, May 12, 2004 at 01:28:04PM +0100, Jonathan Manning wrote:
> > Hi all,
> > 
> > Sorry if this seems more like a general perl question, but I can't find
> > the answer I need in my books.
> > 
> > How do I pass an object (specifically a Bio::Seq object) to a perl
> > subroutine? I thought object variables were references anyway, but
> > passing those variables didn't work. At the moment I pass a reference
> > like:
> > 
> > $reference = \$seqobject;
> > &subroutine($reference);
> > 
> > And within the subroutine attempt to access like:
> > 
> > $sequence = bless @_[0];
> > 
> > But this doesn't work either, and I can't access the object methods.
> > 
> > Obviously I'm no perl veteran, and don't really know how to do it.
> > Thanks in advance for any help.
> 
> A Perl object is already a [blessed] reference.
> 
> sub grok
> {
>     my $birney = shift;
>     return $birney->poke();
> }
> 
> my $thing = Bio::somemodule->new({ stuff => 'this' });
> print grok($thing);
> 
> (well, you get the idea)
> 
> 
> 
> Andreas



More information about the Bioperl-l mailing list