Phoenix.pm: more specific question

Phaedrus phaedrus at endless.org
Fri Dec 10 11:55:14 CST 1999


> From: Beaves at aol.com
> 
> When you print to STDOUT, is it a pipe?  or does STDOUT wait until some sort 
> of a flush command at the 'death' of the program, and then spill its 
> contents...
> 
> If it flushes rather than pipes, is there a way to modify the flush routine 
> upon its call?

Pipes can be flushed too...
Most of the functions in Perl are just wrappers for kernel or C library
calls. Perls handling of IO is usualy POSIX - if your system is POSIX.
POSIX established rules that were a comprimise between good performance,
and reliability. For example, it is gaurenteed that if you write
something, seek backwards, and re-read it, it will be the data you wrote.
However, if another process reads your file, and you havn't either closed
the filehandle or flushed it, it is not gaurenteed to be up to date. POSIX
specs allow the OS to buffer and cache and delay writes and other
performance optimizing things like that.. some OSs may bring the files up
to date automaticly within seconds, other may wait minutes, and on most it
depends on the load. This is really way beyond the scope of Perl, but
suffice to say, for details on alot of the Perl functions, read the C man
pages, and remember they are just "wrappers" for the OS implementation of
functions of the same name, and therefore slightly platform dependent (if
the OS varied from the POSIX specs). If you install Perl yourself, you
will get interesting statistics on how compatable your Perl build is...
after it does regression testing. Cool =)

> 
> I remember  reading some stuff about this behavior, but I can't seem to find 
> it now.
> 
> Not  a big deal, but maybe some discussion material.
> 
> Tim
> 

Oh yeah, a great place to get Unix man pages on the web (IE, you dont have
Unix installed) ;) is www.freebsd.org, in the documentation section. Pick
search documentation. You can search Linux, 4.4 BSD, FreeBSD, and Solaris
man pages for more details on things like flush/fflush =)
On the same note, as soon as I knock down about 30 other projects, I wanna
make this discussion searchable/indexed...

-scott




More information about the Phoenix-pm mailing list