summaryrefslogtreecommitdiff
path: root/lib/Net/OpenSSH/Constants.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/OpenSSH/Constants.pm')
-rw-r--r--lib/Net/OpenSSH/Constants.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Net/OpenSSH/Constants.pm b/lib/Net/OpenSSH/Constants.pm
index 42fa6de..f1ef3cc 100644
--- a/lib/Net/OpenSSH/Constants.pm
+++ b/lib/Net/OpenSSH/Constants.pm
@@ -5,10 +5,11 @@ our $VERSION = '0.51_07';
use strict;
use warnings;
use Carp;
+use Scalar::Util ();
require Exporter;
our @ISA = qw(Exporter);
-our %EXPORT_TAGS = (error => []);
+our %EXPORT_TAGS = (error => [], _state => []);
my %error = ( OSSH_MASTER_FAILED => 1,
OSSH_SLAVE_FAILED => 2,
@@ -26,6 +27,22 @@ for my $key (keys %error) {
push @{$EXPORT_TAGS{error}}, $key
}
+my @states = qw(_STATE_START
+ _STATE_LOGIN
+ _STATE_AWAITING_MUX
+ _STATE_RUNNING
+ _STATE_KILLING
+ _STATE_GONE
+ _STATE_STOPPED);
+
+my $last_value;
+for my $state (@states) {
+ no strict 'refs';
+ my $value = Scalar::Util::dualvar(++$last_value, $state);
+ *{$state} = sub () { $value };
+ push @{$EXPORT_TAGS{_state}}, $state
+}
+
our @EXPORT_OK = map { @{$EXPORT_TAGS{$_}} } keys %EXPORT_TAGS;
$EXPORT_TAGS{all} = [@EXPORT_OK];
@@ -55,7 +72,7 @@ This module exports the following constants:
OSSH_SLAVE_TIMEOUT - slave process timeout
OSSH_SLAVE_CMD_FAILED - child process exited with a non zero status
OSSH_SLAVE_SFTP_FAILED - creation of SFTP client failed
- OSS_ENCODING_ERROR - some error related to the encoding/decoding of strings happened
+ OSSH_ENCODING_ERROR - some error related to the encoding/decoding of strings happened
=back