[Wellington-pm] pass-through pipe?

Daniel Pittman daniel at rimspace.net
Sat Jul 17 23:05:14 PDT 2010


Richard Hector <richard at walnut.gen.nz> writes:

> My question may well be unclear, because I may not understand the problem.
> I want to pipe the output of one command to the input of another - stuff
> that's commonly done in the shell.

[...]

> It seems that it is cleaner, more efficient, and perhaps more secure,
> though, to do such things as piped opens entirely within perl.

More or less.  It is a bit trickier than it sounds, because you risk a
deadlock using the naive approach.

> Is it possible to create an (unnamed) pipe to which I can connect both
> processes, leaving perl out of the loop until the end?

Yes.

> It would probably be useful to be able to collect standard error and exit
> status from each.

I suggest you investigate IPC::Run to make your life more pleasant, but it is
not the only module implementing this facility, simply one of the many.

Regards,
        Daniel
-- 
✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons


More information about the Wellington-pm mailing list