in reply to RE: How to split output using Expect.pm
in thread How to split output using Expect.pm

Unfortunately not. btrott's filter only works on output coming from your program (and even so has some limitations, as I pointed out it won't catch output from xsubs or system calls you make). kudra is interested in filtering the output of another program.

However your basic idea is good, only the implementation has problems. Indeed you could pipe STDOUT and STDERR of the program through filters that would tag the output. There probably is a nice way to do it, but one silly and inefficient way is to launch a wrapper program that opens pipes to two filter programs that will tag their output, then launches your desired command using IPC::Open3, connecting it's STDIN to yours, and its STDOUT and STDERR to the two filters.

The wrapper can, incidentally, use the wait call to reap the children and also get the exit code of the command you are trying to wrap.

  • Comment on RE (tilly) 2: How to split output using Expect.pm

Replies are listed 'Best First'.
RE: RE (tilly) 2: How to split output using Expect.pm
by Adam (Vicar) on Aug 17, 2000 at 03:35 UTC
    Yeah, I realized that too... and I msged kudra, but I never quite got around to updating my post.

    Besides, I really like that filter and I was hoping someone would find a way to make that solution work :-)