File Coverage

blib/lib/Net/SFTP/Foreign/Constants.pm
Criterion Covered Total %
statement 22 23 95.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Net::SFTP::Foreign::Constants;
2              
3             our $VERSION = '1.63_05';
4              
5 5     5   148571 use strict;
  5         19  
  5         143  
6 5     5   25 use warnings;
  5         9  
  5         110  
7              
8 5     5   24 use Carp;
  5         10  
  5         1204  
9              
10             require Exporter;
11             our @ISA = qw(Exporter);
12             our (@EXPORT_OK, %EXPORT_TAGS);
13              
14             BEGIN {
15 5     5   329 my %constants = ( SSH2_FXP_INIT => 1,
16             SSH2_FXP_VERSION => 2,
17             SSH2_FXP_OPEN => 3,
18             SSH2_FXP_CLOSE => 4,
19             SSH2_FXP_READ => 5,
20             SSH2_FXP_WRITE => 6,
21             SSH2_FXP_LSTAT => 7,
22             SSH2_FXP_FSTAT => 8,
23             SSH2_FXP_SETSTAT => 9,
24             SSH2_FXP_FSETSTAT => 10,
25             SSH2_FXP_OPENDIR => 11,
26             SSH2_FXP_READDIR => 12,
27             SSH2_FXP_REMOVE => 13,
28             SSH2_FXP_MKDIR => 14,
29             SSH2_FXP_RMDIR => 15,
30             SSH2_FXP_REALPATH => 16,
31             SSH2_FXP_STAT => 17,
32             SSH2_FXP_RENAME => 18,
33             SSH2_FXP_READLINK => 19,
34             SSH2_FXP_SYMLINK => 20,
35             SSH2_FXP_STATUS => 101,
36             SSH2_FXP_HANDLE => 102,
37             SSH2_FXP_DATA => 103,
38             SSH2_FXP_NAME => 104,
39             SSH2_FXP_ATTRS => 105,
40             SSH2_FXP_EXTENDED => 200,
41             SSH2_FXP_EXTENDED_REPLY => 201,
42              
43             SSH2_FXF_READ => 0x01,
44             SSH2_FXF_WRITE => 0x02,
45             SSH2_FXF_APPEND => 0x04,
46             SSH2_FXF_CREAT => 0x08,
47             SSH2_FXF_TRUNC => 0x10,
48             SSH2_FXF_EXCL => 0x20,
49              
50             SSH2_FX_OK => 0,
51             SSH2_FX_EOF => 1,
52             SSH2_FX_NO_SUCH_FILE => 2,
53             SSH2_FX_PERMISSION_DENIED => 3,
54             SSH2_FX_FAILURE => 4,
55             SSH2_FX_BAD_MESSAGE => 5,
56             SSH2_FX_NO_CONNECTION => 6,
57             SSH2_FX_CONNECTION_LOST => 7,
58             SSH2_FX_OP_UNSUPPORTED => 8,
59              
60             SSH2_FILEXFER_ATTR_SIZE => 0x01,
61             SSH2_FILEXFER_ATTR_UIDGID => 0x02,
62             SSH2_FILEXFER_ATTR_PERMISSIONS => 0x04,
63             SSH2_FILEXFER_ATTR_ACMODTIME => 0x08,
64             SSH2_FILEXFER_ATTR_EXTENDED => 0x80000000,
65              
66             SSH2_FILEXFER_VERSION => 3,
67              
68             SSH2_FXE_STATVFS_ST_READONLY => 0x1,
69             SSH2_FXE_STATVFS_ST_NOSUID => 0x2,
70              
71             SFTP_ERR_REMOTE_STAT_FAILED => 1,
72             SFTP_ERR_REMOTE_OPEN_FAILED => 2,
73             SFTP_ERR_LOCAL_ALREADY_EXISTS => 3,
74             # SFTP_ERR_LOCAL_OPEN_FAILED => 4,
75             SFTP_ERR_LOCAL_OPEN_FAILED => 26,
76             SFTP_ERR_REMOTE_READ_FAILED => 5,
77             SFTP_ERR_REMOTE_BLOCK_TOO_SMALL => 6,
78             SFTP_ERR_LOCAL_WRITE_FAILED => 7,
79             SFTP_ERR_REMOTE_BAD_PERMISSIONS => 8,
80             SFTP_ERR_LOCAL_CHMOD_FAILED => 9,
81             SFTP_ERR_REMOTE_BAD_TIME => 10,
82             SFTP_ERR_LOCAL_UTIME_FAILED => 11,
83             SFTP_ERR_REMOTE_BAD_MESSAGE => 13,
84             SFTP_ERR_REMOTE_REALPATH_FAILED => 14,
85             SFTP_ERR_REMOTE_OPENDIR_FAILED => 15,
86             SFTP_ERR_REMOTE_WRITE_FAILED => 16,
87             SFTP_ERR_REMOTE_RENAME_FAILED => 17,
88             SFTP_ERR_REMOTE_LSTAT_FAILED => 18,
89             SFTP_ERR_REMOTE_FSTAT_FAILED => 19,
90             SFTP_ERR_REMOTE_CLOSE_FAILED => 20,
91             SFTP_ERR_REMOTE_REMOVE_FAILED => 21,
92             SFTP_ERR_REMOTE_MKDIR_FAILED => 22,
93             SFTP_ERR_REMOTE_RMDIR_FAILED => 23,
94             SFTP_ERR_REMOTE_SETSTAT_FAILED => 24,
95             SFTP_ERR_REMOTE_FSETSTAT_FAILED => 25,
96             SFTP_ERR_LOCAL_STAT_FAILED => 27,
97             SFTP_ERR_LOCAL_READ_ERROR => 28,
98             SFTP_ERR_REMOTE_READDIR_FAILED => 29,
99             SFTP_ERR_REMOTE_READLINK_FAILED => 30,
100             SFTP_ERR_REMOTE_SYMLINK_FAILED => 31,
101             SFTP_ERR_REMOTE_BAD_PATH => 32,
102             SFTP_ERR_LOCAL_MKDIR_FAILED => 33,
103             SFTP_ERR_LOCAL_SYMLINK_FAILED => 34,
104             SFTP_ERR_REMOTE_BAD_OBJECT => 35,
105             SFTP_ERR_REMOTE_ACCESING_CLOSED_FILE => 36,
106             SFTP_ERR_CONNECTION_BROKEN => 37,
107             SFTP_ERR_LOCAL_GENERIC_ERROR => 38,
108             SFTP_ERR_LOCAL_READLINK_FAILED => 39,
109             SFTP_ERR_LOCAL_BAD_PATH => 40,
110             SFTP_ERR_LOCAL_BAD_OBJECT => 41,
111             SFTP_ERR_REMOTE_ALREADY_EXISTS => 42,
112             # SFTP_ERR_BAD_SSH_BINARY => 43,
113             SFTP_ERR_ABORTED => 44,
114             SFTP_ERR_REMOTE_BIGGER_THAN_LOCAL => 45,
115             SFTP_ERR_LOCAL_BIGGER_THAN_REMOTE => 46,
116             SFTP_ERR_LOCAL_SEEK_FAILED => 47,
117             SFTP_ERR_REMOTE_STATVFS_FAILED => 48,
118             SFTP_ERR_REMOTE_FSTATVFS_FAILED => 49,
119             SFTP_ERR_PASSWORD_AUTHENTICATION_FAILED => 50,
120             SFTP_ERR_REMOTE_HARDLINK_FAILED => 51,
121             SFTP_ERR_LOCAL_RENAME_FAILED => 52,
122             SFTP_ERR_REMOTE_FSYNC_FAILED => 53,
123             );
124              
125 5         110 for my $key (keys %constants) {
126 5     5   36 no strict 'refs';
  5         11  
  5         841  
127 500         765 my $value = $constants{$key};
128 500         1866 *{$key} = sub () { $value }
  0         0  
129 500         2363 }
130              
131 5         80 @EXPORT_OK = keys %constants;
132              
133 5         34 my %etagre = qw( fxp SSH2_FXP_
134             flags SSH2_FXF_
135             att SSH2_FILEXFER_ATTR
136             status SSH2_FX_
137             error SFTP_ERR_
138             ext SSH2_FXE_);
139              
140 5         17 for my $key (keys %etagre) {
141 30         304 my $re = qr/^$etagre{$key}/;
142 30         1729 $EXPORT_TAGS{$key} = [grep $_=~$re, @EXPORT_OK];
143             }
144             }
145              
146             1;
147             __END__