#718882 libnet-telnet-cisco-perl: cmd() returns [ undef ] instead of empty list on error

#718882#5
Date:
2013-08-06 13:04:09 UTC
From:
To:
When using errmode == return and calling cmd() in list context and an error is
detected during command processing, Net::Telnet:::Cisco will return

	$VAR1 = [ undef ];

instead of an empty list

	$VAR1 = [];

However perldoc Net::Telnet states

	When mode is "return" then the method generating the error places an
	error message in the object and returns an undefined value in a scalar
	context and an empty list in list context.  The error message may be
	obtained using "errmsg()".

And perldoc Net::Telnet::Cisco states:

	Before you use Net::Telnet::Cisco, you should have a good understanding
	of Net::Telnet, so read it's documentation first, and then come back
	here to see the improvements.

This patch seems to fix the problem:
--- /tmp/Cisco.pm	2013-08-06 15:01:51.000000000 +0200
+++ /usr/share/perl5/Net/Telnet/Cisco.pm	2013-08-06 14:54:50.000000000 +0200
@@ -202,6 +202,7 @@

 	if ($self->find_errors(@out) ) {
 	    $ok = 0;
+	    @out = ();
 	    last;
 	}