> 
> My grreting
>  
> I m developing a script that will send telnet commands to a telnet
> Server, I m getting to send all the commands but I never know if that
> was sucefull done or not....I would like to know if it is possible to
> know if I can figure when my commads done was sucefull executed. Other
> problem is that when I send commands I would like to see the aswer of my
> commads on my screen where I m running my perl script... for example
> when I send dir..i want to see in my telnet script all the dirs listened
> in the remote telnet. I m working on it for longer and I do not know
> what to do :-(
>  
> I thanks any help  very much
>  

Pasted code from second message...

sub cmdLSActivity {
  my $pwd = $FTP->Pwd();
  $pwd  =~ s|/|\\|g;
  my $pathViewDeliver = $dirViewServ . $pwd;
  $telnet->cmd("cleartool lsactivity -s -view $viewDesenv");
  print $telnet->getlines(all); # this command is not helping anything
:-(
}

You are using both a $FTP and a $telnet inside this sub, which we have
no idea where they came from, which is probably not how the code should
be laid out but that is for another discussion.

Assuming your $telnet is a Net::Telnet object I don't believe you want
to use the 'getlines' object method directly as that deals with the
underlying object and an open file descriptor it is using in the
session. To capture the output from 'cmd' I believe you should either
store it directly to an array (as opposed to in void context) or store
the return code to a scalar and pass a reference to the command using
the 'output' parameter.  So something like:

my @output = $telnet->cmd("cleartool lsactivity -s -view $viewDesenv");

-or-

my @output;
my $result = $telnet->cmd('String' => "cleartool lsactivity -s -view
$viewDesenv", 'Output' => [EMAIL PROTECTED]);

Should re-read the documentation for Net::Telnet paying specific
attention to the definition of 'cmd'...

perldoc Net::Telnet

Does this get it?

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to