T
ThERiZla
Hi,
I do a connection on the server witn Telnet.
My problem is when I execute a command on command prompt.
This is my command : my @outputcreateUser = $telnet->cmd($createUser);
I want obtain the result of the command but when I print the array
@outputCreateUser there is nothing in the array.
This is my code to connect to the server:
## Create a Net::Telnet object
use Net::Telnet ();
$telnet = new Net::Telnet (Timeout => 20,
Input_log => $fileInput,
Output_log => $fileOutput,
Errmode => 'return',
Prompt => $prompt);
if (! defined $telnet) {
die "Unable to create telnet object for $host";
}
$telnet->open($host);
if ($msg = $telnet->errmsg) {
die "Unable to open telnet to $host $msg";
}
$telnet->login($username, $password);
if ($msg = $telnet->errmsg) {
die "Unable to login to $host $msg PWD: $password";
}
return $telnet;
I like know if I do something wrong.
An explication and an example will be appreciate.
Thanks
I do a connection on the server witn Telnet.
My problem is when I execute a command on command prompt.
This is my command : my @outputcreateUser = $telnet->cmd($createUser);
I want obtain the result of the command but when I print the array
@outputCreateUser there is nothing in the array.
This is my code to connect to the server:
## Create a Net::Telnet object
use Net::Telnet ();
$telnet = new Net::Telnet (Timeout => 20,
Input_log => $fileInput,
Output_log => $fileOutput,
Errmode => 'return',
Prompt => $prompt);
if (! defined $telnet) {
die "Unable to create telnet object for $host";
}
$telnet->open($host);
if ($msg = $telnet->errmsg) {
die "Unable to open telnet to $host $msg";
}
$telnet->login($username, $password);
if ($msg = $telnet->errmsg) {
die "Unable to login to $host $msg PWD: $password";
}
return $telnet;
I like know if I do something wrong.
An explication and an example will be appreciate.
Thanks