Buffering piped output of a script to another script...
by Brett Carroll other posts by this author
Aug 27 2008 1:56PM messages near this date
Re: help with Win32::TieRegistry
|
Re: Buffering piped output of a script to another script...
Is it possible to buffer the data coming in ($_) based on size rather than
waiting for a newline?
Here is a test scenario:
#script1.pl
while(1){
print "Sent: " . localtime() . "\n";
}
------------------------------
#script2.pl:
print "Received: $_";
Running the above scripts using: "perl script1.pl | perl -n script2.pl"
works fine (as expected). However I wonder if it is possible to remove
the "\n" from the print statement in script1.pl and let script2.pl handle
the buffering, by this I mean process the print "Received: $_"; line only
when $_ contains x number of characters, bytes, etc...
Note: Target platform is Win32.
Thanks,
Brett Carroll
Thread:
Brett Carroll
Bill Luebkert
|