Subject: | Possible bug with Cisco pager prompt handling |
Date: | Wed, 08 Oct 2008 14:51:10 +1030 |
To: | bug-Net-Telnet-Cisco [...] rt.cpan.org |
From: | Mark Smith <marksmith [...] adam.com.au> |
Hi,
I think I've found a bug which effects the ability to use the perl
'grep' command to filter the output of a ->cmd() command, when the
output exceeds the default terminal length.
I was finding that the results of the grep against a "show
running-config" command sometimes had a newline as the very first
character. Dumping the output buffer in hex, showed that after a certain
point, the newline at the end of a Cisco command had been somehow moved
to the start of the next line. Here's a snippet of a Data::Hexdumper
dump of each entry in the Cisco command output array. Character 0x0A is
the newline, and you can see that it goes from normally being at the end
of the line as expected to the start of the next line after the "ip
subnet-zero" command.
--
0x0000 : 0A 61 61 61 20 61 75 74 68 65 6E 74 69 63 61 74 :
.aaa.authenticat
0x0010 : 69 6F 6E 20 6C 6F 67 69 6E 20 64 65 66 61 75 6C :
ion.login.defaul
0x0020 : 74 20 6C 6F 63 61 6C : t.local
0x0000 : 0A 61 61 61 20 73 65 73 73 69 6F 6E 2D 69 64 20 :
.aaa.session-id.
0x0010 : 63 6F 6D 6D 6F 6E : common
0x0000 : 0A 69 70 20 73 75 62 6E 65 74 2D 7A 65 72 6F :
.ip.subnet-zero
0x0000 : 0A 21 : .!
0x0000 : 0A 21 : .!
0x0000 : 0A 69 70 20 63 65 66 : .ip.cef
0x0000 : 0A 6E 6F 20 69 70 20 64 6F 6D 61 69 6E 20 6C 6F :
.no.ip.domain.lo
0x0010 : 6F 6B 75 70 : okup
--
It occurred to me after a while that the point where the newline is
moving could be where the Cisco output pager " --More-- " prompt was
occuring in the Cisco CLI output. It is possible to disable the Cisco
pager by setting the terminal screen length to zero e.g.:
$cisco->cmd('term len 0');
So I tried that and the problem then disappeared - all lines of output
had their newlines at the end. So it seems there might be a bug in the
way that the "--More--" prompt is being handled, however there is also
an easy work around.
Thanks,
Mark.