[Bioperl-l] Bioperl objects and subroutines

Stefan Kirov skirov at utk.edu
Wed May 12 12:29:02 EDT 2004


Brian,
I like GUI debuggers I guess I am spoiled :-P . Actually the only reason 
I have something called Win XP (still unsure why some call it OS) is 
open PerlIDE. It is surprisingly good and makes my life much easier as I 
am not a Perl guru.
Thanks for the tip.
Stefan

Brian Osborne wrote:

>Stefan,
>
>  
>
>>If you have
>>a debugger like ptkdb (perl -d:ptkdb somescript.pl) take a look at what
>>actually $seq contains.
>>    
>>
>
>Or use the "x" command in the perl debugger:
>
>  
>
>>perl -d <script>
>>    
>>
>
>Followed by:
>
><DB>x $seq
>
>
>Brian O.
>
>
>-----Original Message-----
>From: bioperl-l-bounces at portal.open-bio.org
>[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Stefan Kirov
>Sent: Wednesday, May 12, 2004 10:44 AM
>To: bmb9jrm at bmb.leeds.ac.uk
>Cc: bioperl-l at bioperl.org
>Subject: Re: [Bioperl-l] Bioperl objects and subroutines
>
>Hi Jonathan,
>I believe what you should do is:
>
>my $seq=new Bio::Seq (-seq=>'acagtcgatgc', -id=>'blabla');
>somesub($seq);
>
>sub somesub {
>my $seq=shift;
>print $seq->id;
>}
>And I think you should not be blessing a blessed reference. If you have
>a debugger like ptkdb (perl -d:ptkdb somescript.pl) take a look at what
>actually $seq contains. Also depending on how you call the sub, @_[0]
>may contain the package name or other data. @_ is a tricky bussiness, be
>carefult with it. Caling &somesub makes current @_ available to somesub
>(which I don't know what is in your script). Try subroutine($seqobject)
>instead like in the above example.
>
>Hope this helps
>Stefan
>
>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.
>>
>>Jon
>>
>>_______________________________________________
>>Bioperl-l mailing list
>>Bioperl-l at portal.open-bio.org
>>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>
>>
>>    
>>
>
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l at portal.open-bio.org
>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
>  
>

-- 
Stefan Kirov, Ph.D.
University of Tennessee/Oak Ridge National Laboratory
1060 Commerce Park, Oak Ridge
TN 37830-8026
USA
tel +865 576 5120
fax +865 241 1965
e-mail: skirov at utk.edu
sao at ornl.gov



More information about the Bioperl-l mailing list