Perl Monk, Perl Meditation | |
PerlMonks |
Asynchronously capturing output from an external programby Furple (Novice) |
on Nov 08, 2010 at 22:33 UTC ( [id://870209]=perlquestion: print w/replies, xml ) | Need Help?? |
Furple has asked for the wisdom of the Perl Monks concerning the following question:
Perl Monks please help! 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.startup looks like: Then in a set of individual test I fire:
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.
Back to
Seekers of Perl Wisdom
|
|