On Dec 24, 2003, at 2:03 PM, R. Joseph Newton wrote:
[..]
>
> use strict;
> use warnings;
>
> my @remote_cmd_list = ('print "Hello, world!\n";');
>
> # my $foo_bar = Net::Foo::Bar->new(@net_connect_stuff);
> my $filename = 'debug_runs/debug_' . time . '.log';
>
> {
> open DEBUG_LOG, ">$filename" or die "Couldn't output to debug log:
> $!";
> local *STDOUT = *DEBUG_LOG;
wouldn't you also want
local *STDERR = *DEBUG_LOG;
so as to 'trap' the possibility that it
was printing to stderr as well?
> foreach my $cmd (@remote_cmd_list)
> {
> do_remote($cmd);
> }
> }
[..]
> Which should allow normal IO to continue as soon as output from the
> commands has been captured.
I personally would want to have a bit more
coherency in my Net::Foo::Bar so that if
we need to do a 'tee_output()' that it
would have a mechanism for doing the
send to log_logfile and straight out
the door to the command line.
Either that or I would probably want it
to be returning to the code the responses
that it got back from the far server ....
ciao
drieux
---
Thread Previous
|
Thread Next