This should be simple, but I'm doing something stupid. Im just trying to read the @lines from a command using Net::Telnet. I've followed the example, but still having trouble. My input_log shows the whole transaction, but it doesnt come out in the @lines array like it should... can anyone see whats wrong?
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '//', Input_log => "sess.txt");
$t->open($hostip);
#$t->waitfor('/:/');
$t->login($username, $passwd);
$t->waitfor('/#/');
@lines = $t->cmd('who');
$t->waitfor('/#/');
print @lines;
Heres what happens when I run it
[root@server /test_dir]# ./test.pl
[root@server /test_dir]#
(Notice, no output)
Here is my input file Sess.txt
User Access Verification
Username: lvennard
Password:
switch#who
Line User Host(s) Idle Location
* 1 vty 0 lvennard idle 00:00:00 testbox
Interface User Mode Idle Peer Address
switch#
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10, Prompt => '//', Input_log => "sess.txt");
$t->open($hostip);
#$t->waitfor('/:/');
$t->login($username, $passwd);
$t->waitfor('/#/');
@lines = $t->cmd('who');
$t->waitfor('/#/');
print @lines;
Heres what happens when I run it
[root@server /test_dir]# ./test.pl
[root@server /test_dir]#
(Notice, no output)
Here is my input file Sess.txt
User Access Verification
Username: lvennard
Password:
switch#who
Line User Host(s) Idle Location
* 1 vty 0 lvennard idle 00:00:00 testbox
Interface User Mode Idle Peer Address
switch#