Thank you for the update. I just tried as following-
use Net::Telnet::Cisco;
my ($host, $user, $pass) = qw(10.10.1.1 user pass);
my $cs = Net::Telnet::Cisco->new(
Host => $host,
Port => $port,
Dump_Log => 'cisco.log',
Prompt => '/(?m:^\W?[\w\/\d.:-]+[>#])/',
);
$cs->send_wakeup('connect');
$cs->login( $user, $pass );
print "username and password sent\n";
my @cmd_output = $cs->cmd( 'show cdp nei' );
print @cmd_output;
$cs->close;
But, I am getting the following error-
username and password sent
command timed-out at c:\temp\dir6483.tmp\sendWake.pl line 28
Press any key to continue . . .
line 28: my @cmd_output = $cs->cmd( 'show cdp nei' );
After that when I use putty to access, I can see that it's displaying my "show cdp nei" and didn't ask for authentication, as I have already provided thru the script. However, it didn't display in the script output and gave me that error.
Please let me know.
##
UPDATE:
never mind... it's working. I just had to add 'term leng 0' first. Thank you all.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.