Subject: | wrong exit code for a script using Net-Appliance-Session version 1.32 |
Date: | Wed, 03 Dec 2008 17:04:45 +0200 |
To: | bug-Net-Appliance-Session [...] rt.cpan.org |
From: | Victor Gartvich <victor [...] cotendo.com> |
Hello,
Net-Appliance-Session version 1.32. A very simple script from the source
package (recipe02.pl):
========================================================================
=========
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::Appliance::Session;
my $ios_device_ip = 'router';
my $ios_username = 'username';
my $ios_password = 'password';
my $ios_enable_password = 'password';
my $session_obj = Net::Appliance::Session->new(
Host => $ios_device_ip,
Transport => 'SSH',
);
# give verbose output whilst we run this script
# $session_obj->input_log(*STDOUT);
# try to login to the ios device, ignoring host check
$session_obj->connect(
Name => $ios_username,
Password => $ios_password,
SHKC => 0
);
# drop in to enable mode
$session_obj->begin_privileged($ios_enable_password);
# close down our session
$session_obj->close;
exit 0;
========================================================================
=========
I can successfully run the script, but the returned exit code is
inconsistent: about half of the times I get code 0, and half of the time
I get a strange code 255.
# perl recipe02.pl ; echo $?
255
# perl recipe02.pl ; echo $?
255
# perl recipe02.pl ; echo $?
255
# perl recipe02.pl ; echo $?
0
# perl recipe02.pl ; echo $?
0
# perl recipe02.pl ; echo $?
255
# perl recipe02.pl ; echo $?
255
# perl recipe02.pl ; echo $?
0
# perl recipe02.pl ; echo $?
255
# perl recipe02.pl ; echo $?
0
# perl recipe02.pl ; echo $?
255
It looks like the 255 error code is return by the class destructor, but
I have no idea what can cause a problem.
Your help will be highly appreciated.
Kind regards,
Victor