Subject: | The _normalize routine splits line wrong after removing --more-- |
Date: | Fri, 30 Sep 2016 16:00:03 +0000 |
To: | "bug-Net-Telnet-Cisco [...] rt.cpan.org" <bug-Net-Telnet-Cisco [...] rt.cpan.org> |
From: | Johan Finnved <Johan.Finnved [...] cygate.se> |
Problem in Nwt::Telnet::Cisco ver 1.10
Lines after --more-- are not split after newline
as the ones before --more-- .
In fact, they are split after newline instead of before.
This is easily corrected in the subroutine _normalize:
Please change line 756 from
return wantarray ? split /$/mg, $_ : $_; # ORS instead?
to
return wantarray ? split /^/, $_ : $_; # ORS instead?
Note that /^/m is implied when split is invoked with pattern /^/.
(see documentation in http://perldoc.perl.org/functions/split.html )
Minimal test to demonstrate bug.
Note that newlines are at the end of the first lines
and the and at the beginning of later lines (after --more--)
my @response = $session->cmd('show version');
print STDERR YAML::Syck::Dump(\@response);
---
- "Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(44)SE6, RELEASE SOFTWARE (fc1)\n"
<snip>
- "Importers, exporters, distributors and users are responsible for\n"
- "compliance with U.S. and local country laws. By using this product you\n"
- agree to comply with applicable laws and regulations. If you are unable
- "\nto comply with U.S. and local laws, return this product immediately."
- "\n"
- "\nA summary of U.S. laws governing Cisco cryptographic products may be found at:"