|Just another Perl shrine|
Re: How to capture child process output and divert to log4perlby jandrew (Chaplain)
|on Sep 14, 2012 at 23:41 UTC||Need Help??|
I'm not sure this is what your looking for but Capture::Tiny seems to fit your requirements.
Per ww's postWith "system()", both STDOUT and STDERR will go the same place as the script's STDOUT and STDERR, unless the "system()" command redirects
As a test, save the following as warn.pl
If you just run warn.pl you get
But to do what you want you need to redirect just the STDERR. I offer the following code
If you save it as WarnCapture.pl and run that in the same folder as warn.pl you get
Capture::Tiny to the rescue!