Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > STDOUT and STDERR from command lines

Reply
Thread Tools

STDOUT and STDERR from command lines

 
 
Joe
Guest
Posts: n/a
 
      11-05-2012
I wish to have an easy way to capture STDERR and STDOUT from a command line(system("$cmd") or `$cmd`). The methods give on perl FAQ list is complicated (http://perldoc.perl.org/perlfaq8.htm...ternal-command). However the "Net::SSH:erl" module has a very nice way to capture them like in:

my($stdout, $stderr, $exit) = $ssh->cmd($cmd);

I wonder is there a function/module to allow something like:

my($stdout, $stderr, $exit) = `$cmd`;

I did search but fail to find so far. Any advice would be appreciated.

joe
 
Reply With Quote
 
 
 
 
Jim Gibson
Guest
Posts: n/a
 
      11-06-2012
In article <(E-Mail Removed)>, Joe
<(E-Mail Removed)> wrote:

> I wish to have an easy way to capture STDERR and STDOUT from a command line
> (system("$cmd") or `$cmd`). The methods give on perl FAQ list is complicated
> (http://perldoc.perl.org/perlfaq8.htm...from-an-extern
> al-command). However the "Net::SSH:erl" module has a very nice way to
> capture them like in:
>
> my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
>
> I wonder is there a function/module to allow something like:
>
> my($stdout, $stderr, $exit) = `$cmd`;
>
> I did search but fail to find so far. Any advice would be appreciated.


The methods given in the FAQ are complicated, but perhaps that
complexity is required. I would try one of the following and see how
far I got:

IPC::Open3
IPC::Run
IPC::Run3

--
Jim Gibson
 
Reply With Quote
 
 
 
 
Joe
Guest
Posts: n/a
 
      11-08-2012
Wow, it's great to learn. THANK YOU ALL so much!
(I would have no way to find them myself

joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to separate stdout & stderr from executed shell command jqwoods@gmail.com Ruby 6 03-14-2008 10:16 PM
script hangs when run from command line and redirecting stdout and stderr to file it_says_BALLS_on_your forehead Perl Misc 2 01-10-2006 11:31 AM
Re: embedding Python and changing stdin, stdout and stderr Vincent Touquet Python 0 09-06-2004 04:35 PM
embedding Python and changing stdin, stdout and stderr Vincent Touquet Python 1 09-03-2004 12:25 PM
Fetching the stdout & stderr as it flows from a unix command. Hans Deragon Python 2 06-04-2004 08:04 PM



Advertisments