cybear has asked for the wisdom of the Perl Monks concerning the following question:
Quick and dirty explaination: I need a way of splitting STDERR
in the same way that the /bin/tee command splits STDOUT.
I am using Net::FTP to login and retrieve a file from a VAN,
(value added network). After retrieving data the VAN returns a line
Total bytes retrieved: 0 stored: 0... I need to be able to "catch" this line in a logfile AND still have the messages send to STDERR.
I am using Debug => 1 when I call Net::FTP
use Net::FTP; $ftp = Net::FTP->new("servername", Debug => 1); $ftp->login("username","passwd"); $ftp->message(); $ftp->cwd("/tmp"); $ftp->get("some.file"); print "get returned: $ftp\n"; $ftp->quit;
So, the line that I mention above is returned to STDERR, just as perldoc.com documentation says. My problem is that I need to be able to BOTH, have this information printed to STDERR for my system to log it AND be able to capture this data in a separate logfile that my Operations group can monitor.
As you can see from the code above, I have tried using message(), inherited from Net::Cmd, and printing the value of $ftp. However, these options only print the Net::FTP=GLOB(0x226c14) value of the command, I need the text messages.
I have tried using filehandles and several other creative, but unsuccessful options.
I can easily redirect STDERR to a file, or allow STDERR to operate normally, but I have not been able to get BOTH to work. Please help if you can.
Edited: Fri Jun 21 15:12:08 2002 (GMT), by Footpad: Fixed broken </CODE> tag and modified HTML Formatting to improve XML compatibility.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splittig STDERR output to file AND STDERR
by broquaint (Abbot) on Jun 21, 2002 at 14:45 UTC | |
by cybear (Monk) on Jun 27, 2002 at 13:13 UTC | |
|
Re: Splittig STDERR output to file AND STDERR
by flounder99 (Friar) on Jun 21, 2002 at 14:58 UTC | |
by cybear (Monk) on Jun 21, 2002 at 15:27 UTC | |
|
Re: Splittig STDERR output to file AND STDERR
by grantm (Parson) on Jun 21, 2002 at 15:15 UTC | |
by cybear (Monk) on Jun 21, 2002 at 15:24 UTC | |
|
Re: Splittig STDERR output to file AND STDERR
by Anonymous Monk on Jun 22, 2002 at 03:13 UTC | |
by cybear (Monk) on Jun 27, 2002 at 13:31 UTC |