[Bioperl-l] flushing i/o with TreeIO
Aaron J Mackey
Aaron J. Mackey" <amackey@virginia.edu
Fri, 12 Jul 2002 10:47:04 -0400 (EDT)
Right - in fact all (?) Perl file handles (my $fh = \*STDIN) seem to be
IO::Handle's (but you need to yourself load IO::Handle in order to use the
methods - a bit odd) :
perl -MIO::Handle -e '$fh = \*STDOUT; print $fh "foo"; $fh->flush; sleep(3)'
-Aaron
On Fri, 12 Jul 2002, Lincoln Stein wrote:
> If you use IO::Handle, this will give a flush() method that you can apply to
> the filehandle. That way you can flush the filehandle without turning on
> autoflush.
>
> Lincoln
>
> On Thursday 11 July 2002 06:26 pm, Aaron J Mackey wrote:
> > Shouldn't we be flushing our filehandles after we finish with a
> > write_seq?? Is there some reason not to? It seems like not doing so just
> > leads to this kind of odd, "behind the scenes" behavior ...
> >
> > -Aaron
> >
> > On Thu, 11 Jul 2002, Jason Stajich wrote:
> > > You can do this by destructing the object -
> > > $treeout = undef;
> > > Since Bio::TreeIO objects are Bio::Root::IO objects you should be able to
> > > close the filehandle by saying
> > > $treeout->close();
> > >
> > > There is a way to turn autoflushing on by saying
> > > $treeout->fh->autoflush(1) ;
> > > but I think the above will work for you.
> > >
> > > HTH.
> > >
> > > > The only solution I have found is to return from the subroutine where
> > > > the tree manipulation is happening.
> > > >
> > > > How do I flush output to file, or close the output file, to make it
> > > > available for future reads, without having to exit the subroutine?
> > > >
> > > > Thanks,
> > > > Howard
>
>
--
Aaron J Mackey
Pearson Laboratory
University of Virginia
(434) 924-2821
amackey@virginia.edu