For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > August 2005 > autoflush() and how to find the code of a method...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author autoflush() and how to find the code of a method...
Ilya Zakharevich

2005-08-30, 6:58 pm

[A complimentary Cc of this posting was sent to
Hal Vaughan
<hal@thresholddigital.com>], who wrote in article <Wc6dnQaSDP_qDIneRVn-iQ@comcast.com>:
> I have $| = 1 set, since I had to redirect output to a file for debugging
> and needed the errors to sync with the output, but it doesn't seem to make
> a difference in the problem I'm talking about. You seem to be the only
> person that has pointed out this doesn't effect the buffers directly.


Remember that $| affects the currently select(1arg)ed filehandle. Let
me see... Yes, the ->autoflush() method will do select()ing for you....

Hope this helps,
Ilya

P.S. I needed a lot of time to find the source of autoflush(). Best
try (do not know how to do it better so it would work if IO::Handle
would define it in an XSUB...; would some Emacs package help here?):

perl -MFileHandle -wdle "(my $fh = new FileHandle)->open(q[> xx]); $fh->autoflush(1)"
n
s
v

IO::Handle::autoflush(i:/perllib/lib/5.8.2/os2/IO/Handle.pm:465):
464 sub autoflush {
465==> my $old = new SelectSaver qualify($_[0], caller);
466: my $prev = $|;
467: $| = @_ > 1 ? $_[1] : 1;
468: $prev;
469 }

Actually, doing
n
|m $fh

thinks that autoflush() *is* in FileHandle module; it is not. Is it
some bug related to a change of semantic of
exists &function
vs
defined &function
recently?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com