Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: How to cpture output of interactive command using perl.?

by xdg (Monsignor)
on Dec 10, 2008 at 15:16 UTC ( [id://729436] : note . print w/replies, xml ) Need Help??


in reply to Re: How to cpture output of interactive command using perl.?
in thread How to cpture output of interactive command using perl.?

On Unix-like systems...

For a portable, pure-perl approach, there is the Tee module.

use Tee; use File::Temp qw(tempfile); my ($fh, $filename) = tempfile(); close $fh; tee("your_command", $filename);

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.