I have some experience in writing scripts with this excellent module, some of which have been used on c2500 routers.
Sometimes, I find that setting the terminal length to zero at the start of the script can help:
@output=$RSession->cmd(String => 'term length 0', Timeout => '3');
(you need enable mode before sending this command)
Experiment with this, but if all else fails, you could get in touch with the module author via his web forum:
http://nettelnetcisco.sourceforge.net/
HTH,
James.
Bullock, Howard A. wrote:
I am attempting to automate some router changes using Net::Telnet::Cisco and having problems.
The router: IOS (tm) 2500 Software (C2500-J-L), Version 11.2(14)
The cisco module methods seem to work well for login, enable, and cmd('show version'). I run into a problem when I issue cmd('wr'). The router returns the following text:
Building configuration... [OK]
As soon as the 'wr' command is sent the program continues to the end. I even attempt to perform a backup using TFTP after the 'wr' commad. This also seems to not wait for the prompt. My timeout for the commands is set to 40 seconds. I have used the debug dump.log and see what I think is very strange. The 'wr' command is executed, then the TFTP command is executed, then the response from the 'wr' is echoed.
< 0x00000: 5e 5a 0d 0a 63 31 39 34 6e 23 0d 0a 63 31 39 34 ^Z..c194n#..c194 < 0x00010: 6e 23 n#
0x00000: 77 72 0d 0a wr..
0x00000: 63 6f 70 79 20 72 75 6e 6e 69 6e 67 2d 63 6f 6e copy
running-con
0x00010: 66 69 67 20 74 66 74 70 0d 0a 31 36 33 2e 32 34 fig
tftp..163.24
0x00020: 31 2e 31 35 34 2e 31 38 36 0d 0a 63 31 39 34 6e
1.154.186..c194n
0x00030: 2d 63 6f 6e 66 67 0d 0a 0d 0a 0d 0a -confg......
< 0x00000: 77 72 0d 0a 42 75 69 6c 64 69 6e 67 20 63 6f 6e wr..Building
con
< 0x00010: 66 69 67 75 72 61 74 69 6f 6e 2e 2e 2e 0d 0a 5b
figuration.....[
< 0x00020: 4f 4b 5d 0d 0a 63 31 39 34 6e 23 63 6f 70 79 20
OK]..c194n#copy < 0x00030: 72 75 6e 6e 69 6e 67 running
I even scrapped the cmd method and implemented:
$session->print('wr'); $session->waitfor('/\[OK\]/');
This also does not seem to way. Adding "sleep 40;" after the 'wr' command and another "sleep 40;" after the TFTP command got the program to work. This however is not solution. Any assistance would be greatly appreciated.
Howard A. Bullock Global IT Infrastructure 717-810-3584
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs