On Dec 24, 2003, at 12:07 AM, Tushar Gokhale wrote:
I've opened a connection to remote machine through perl script and sending
commands and can see the output on screen but I want to put that output in
File along with the commands that were send. how do I do that?
The obvious first question is how does the "output" get to the command line?
Is your code directly printing it? Or is the code that you are using to connect to the remote machine merely 'leaking' output to the command line?
allow me to illustrate
my $foo_bar = Net::Foo::Bar->new(@net_connect_stuff);
foreach my $cmd (@remote_cmd_list) { $foo_bar->do_remote($cmd); }
in that instance you would know which commands were be sent to the remote host.... and what ever that do_remote() method is doing is 'leaking' information to the command line rather than returning it to your programme.
If on the other hand you were doing something on the order of
foreach my $cmd (@remote_cmd_list) { my @response = $foo_bar->do_remote($cmd); print @response ; }
then all one would need is to do the additional prints
foreach my $cmd (@remote_cmd_list) { print LOGFILE "Doing $cmd\n"; my @response = $foo_bar->do_remote($cmd); print STDOUT @response ; print LOGFILE @response ; }
plus of course the obligatory open(), close()....
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>