diff options
author | Florian Schlichting <fsfs@debian.org> | 2015-08-18 18:15:16 +0200 |
---|---|---|
committer | Florian Schlichting <fsfs@debian.org> | 2015-08-18 18:15:16 +0200 |
commit | f205c147abe36c1a3043cf68d9ff1bcfd6fcc534 (patch) | |
tree | 2d3e9acc46223fe9ad7672ba24155879a0394c36 /lib/Net/OpenSSH/Constants.pm | |
parent | a5b394ff4bfd1c0f10f5dab078424e9f57a81a83 (diff) |
Imported Upstream version 0.64
Diffstat (limited to 'lib/Net/OpenSSH/Constants.pm')
-rw-r--r-- | lib/Net/OpenSSH/Constants.pm | 21 |
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 |