Furple has asked for the wisdom of the Perl Monks concerning the following question:
I'm building integration tests. I have a bunch of machinery that processes an email and then spits out the modified email as a file in a new directory. I've also got a script that generates an email and passes it to the machinery. What I'm trying to do is capture the output from my machinery to figure out the name of the file it's just created.
I'm using Test::More to kick things off.Then in a set of individual test I fire:sub startup : Test(startup) { system("perl $home/filterd.pl &"); sleep(3); #give the program some time to set up it's children etc. }
system("perl $home/filtermail.pl -test -to guy\@whatever.net -id 1234" +);
In order to generate results. The idea is that afterwards I check the output from the first program and then process the file it's generated.
Anyone have ideas as to how I capture the output from the first program? The first program uses syslog() to (if run from a terminal) output debug messages etc to the screen. (Presumably STDOUT?) But I can't capture those messages with STDOUT, the program just hangs waiting for input. My other attempt was capturing the results of the last command executed with $! (in the case of the second chunk of code, by running it with `cmd` instead). But this only gets me THAT programs output saying that it's sent information along. In any case I'm stumped.
update: Added a point of clarification and formatting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Asynchronously capturing output from an external program
by ikegami (Patriarch) on Nov 08, 2010 at 22:36 UTC | |
by Furple (Novice) on Nov 09, 2010 at 17:55 UTC | |
by ikegami (Patriarch) on Nov 09, 2010 at 21:35 UTC | |
|
Re: Asynchronously capturing output from an external program
by bingos (Vicar) on Nov 09, 2010 at 11:16 UTC | |
by Furple (Novice) on Nov 09, 2010 at 17:43 UTC | |
|
Re: Asynchronously capturing output from an external program
by tod222 (Pilgrim) on Nov 09, 2010 at 05:09 UTC | |
by Furple (Novice) on Nov 09, 2010 at 17:39 UTC |