[Bioperl-l] Re: Can't call method "seek" without a package or
object reference
Todd Richmond
todd@andrew2.stanford.edu
Tue, 27 Feb 2001 18:23:11 -0800
On 2/27/01 2:43 PM, "Jason Stajich" <jason@chg.mc.duke.edu> wrote:
> I think it had something to do with compatibility with cross-platforms.
> Hah, lot of good that has gotten us. I wish I could duplicate it here so
> it would be easier to fix. Is there any way you would be able to tinker
> with it Todd to see what works and doesn't.
>
Sure - here's a little test:
use IO::File;
my $fh = IO::File->new_tmpfile() || die "Couldn't create temp file\n";
print STDOUT "Filehandle = ", $fh, "\n";
print STDOUT "Write to temporary file\n";
print $fh "AAAAAAAAAACCCCCCCCCCGGGGGGGGGG\n";
print STDOUT "Now reading from temporary file...\n";
seek($fh,0,0);
while (<$fh>) {print STDOUT;}
print STDOUT "Now change first 10 residues.\n";
seek($fh,0,0);
print $fh "TTTTTTTTTT";
print STDOUT "Now read changed text from temporary file...\n";
seek($fh,0,0);
while (<$fh>) {print STDOUT;}
The output is:
Filehandle = IO::File=GLOB(0xd915e7c)
Write to temporary file
Now reading from temporary file...
AAAAAAAAAACCCCCCCCCCGGGGGGGGGG
Now change first 10 residues.
Now read changed text from temporary file...
TTTTTTTTTTCCCCCCCCCCGGGGGGGGGG
So the problem isn't IO::File or seek().
--
Dr Todd Richmond http://cellwall.stanford.edu/todd
Carnegie Institution email: todd@andrew2.stanford.edu
Department of Plant Biology fax: 1-650-325-6857
260 Panama Street phone: 1-650-325-1521 x431
Stanford, CA 94305