STDOUT
Robert Brockway
robert-5LEc/6Zm6xCUd8a0hrldnti2O/JbrIOy at public.gmane.org
Sun May 16 07:13:56 UTC 2004
On Sun, 16 May 2004, Alan Cohen wrote:
> I have a perl program that gets its input from another program's STDOUT.
>
> This program process STDIN and then decides what it should write to
> STDOUT. In many cases, it will decide to write precisely what it
> received on STDIN. It will only know for sure after it's finished
> reading STDIN.
>
> Currently, I'm storing everything from STDIN to an intermediate file,
> making my decision and then writing either a hard-coded message or the
> intermediate file to STDOUT.
>
> Is there a way that doesn't require the intermediate file?
You could use a "named pipe" (FIFO) which is effectively an intermediate
file sitting in memory rather than on disk. Named pipes sit on the
filesystem like other files but store their contents in memory. Not sure
if it is really much an of advantage but there you have it. See man mknod
and Google for more info on named pipes.
I suppose you could read your data into some sort of data structure you
create in memory but this assumes you know what sort of data you are going
to get. Ditto for reading it into a database (for maximum fun).
Cheers,
Rob
--
Robert Brockway B.Sc. email: robert-5LEc/6Zm6xCUd8a0hrldnti2O/JbrIOy at public.gmane.org, rbrockway-cFo9iiqjkw8eIZ0/mPfg9Q at public.gmane.org
Linux counter project ID #16440 (http://counter.li.org)
"The earth is but one country and mankind its citizens" -Baha'u'llah
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list