The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by paulk@marvin.com]

To All,
I have an application that exactly fits the I/O chaining and filter
requirements and principles discussed in chapter 2. I'm running the Perl on a
pc using Win2000.
I'm trying to do the following: "translate1.pl foo.txt | translate2.pl."
So far I have been unsuccessful in getting output from translate1.pl piped to
translate2.pl. Both translate1.pl and translate2.pl perform as expected when
run without the pipe.
Translate1.pl reads the input file from a filehandle using an explicit
open and a "while (<filehandle>smilie" loop rather than the diamond operator;
output is done via an implicit print to STDOUT. Translate2.pl reads input
from STDIN in a while loop using the diamond operator.
When reviewing the log files generated during several runs, it appears
that the operating system launches translate2.pl first, then runs
translate1.pl while translate2.pl waits. When translate1.pl finishes and
exits translate2.pl picks up and completes.
Has anyone seen this kind of response before? Does anyone know of a
solution or will I have to resort to creating an output file with
translate1.pl and reading an input file with translate2.pl?

Thanks,
Paul

import-bot (20211) [Avatar] Offline
#2
Re: I/O Chaining
[Originally posted by dave]

Paul,

I'm sorry, but I really don't know enough about how Windows interacts with
Perl to answer your question. I've just tried a quick test and it seemed to
work as I expected, but there could well be little "gotchas" under Windows
that I don't know about.

Can I suggest that you post your question at PerlMonnks
(http://perlmonks.org/). You'll get a more informed answer there.

Sorry I can't be any more help.

Dave...
import-bot (20211) [Avatar] Offline
#3
Re: I/O Chaining
[Originally posted by paulk@marvin.com]

Dave,
Thanks for the quick response on my question; I'll take a look at perlmonks.

Paul