Greetings wise brothers.
I am working on a perl program that calls a another executable on my system that I don't control. The second program is rather verbose and emits rather more output than I am not usualy interested in on stderr. I am currently calling it via system $program, @args
Rather than suppress output entirely, I am looking for a way to capture the output and log it via Log::Log4perl, as it may be usefull in future to debug problems. Is there a simple way to do this?
I found this node from 4 years ago, where it appears that the suplicant did control the child process. There is also an FAQ entry which handles the case of a perl module that the users is unwilling to modify by localy replacing print with something that diverts what it receves.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.