File Coverage

blib/lib/Net/SFTP/Server/Constants.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Net::SFTP::Server::Constants;
2              
3 2     2   10 use strict;
  2         3  
  2         65  
4 2     2   9 use warnings;
  2         4  
  2         51  
5 2     2   8 use Scalar::Util qw(dualvar);
  2         4  
  2         908  
6              
7             my %constants = ( SSH_FXP_INIT => 1,
8             SSH_FXP_VERSION => 2,
9             SSH_FXP_OPEN => 3,
10             SSH_FXP_CLOSE => 4,
11             SSH_FXP_READ => 5,
12             SSH_FXP_WRITE => 6,
13             SSH_FXP_LSTAT => 7,
14             SSH_FXP_FSTAT => 8,
15             SSH_FXP_SETSTAT => 9,
16             SSH_FXP_FSETSTAT => 10,
17             SSH_FXP_OPENDIR => 11,
18             SSH_FXP_READDIR => 12,
19             SSH_FXP_REMOVE => 13,
20             SSH_FXP_MKDIR => 14,
21             SSH_FXP_RMDIR => 15,
22             SSH_FXP_REALPATH => 16,
23             SSH_FXP_STAT => 17,
24             SSH_FXP_RENAME => 18,
25             SSH_FXP_READLINK => 19,
26             SSH_FXP_SYMLINK => 20,
27             SSH_FXP_STATUS => 101,
28             SSH_FXP_HANDLE => 102,
29             SSH_FXP_DATA => 103,
30             SSH_FXP_NAME => 104,
31             SSH_FXP_ATTRS => 105,
32             SSH_FXP_EXTENDED => 200,
33             SSH_FXP_EXTENDED_REPLY => 201,
34              
35             SSH_FX_OK => 0,
36             SSH_FX_EOF => 1,
37             SSH_FX_NO_SUCH_FILE => 2,
38             SSH_FX_PERMISSION_DENIED => 3,
39             SSH_FX_FAILURE => 4,
40             SSH_FX_BAD_MESSAGE => 5,
41             SSH_FX_NO_CONNECTION => 6,
42             SSH_FX_CONNECTION_LOST => 7,
43             SSH_FX_OP_UNSUPPORTED => 8,
44              
45             SSH_FILEXFER_ATTR_SIZE => 1,
46             SSH_FILEXFER_ATTR_UIDGID => 2,
47             SSH_FILEXFER_ATTR_PERMISSIONS => 4,
48             SSH_FILEXFER_ATTR_ACMODTIME => 8,
49             SSH_FILEXFER_ATTR_EXTENDED => 0x80000000,
50              
51             SSH_FXF_READ => 1,
52             SSH_FXF_WRITE => 2,
53             SSH_FXF_APPEND => 4,
54             SSH_FXF_CREAT => 8,
55             SSH_FXF_TRUNC => 16,
56             SSH_FXF_EXCL => 32);
57              
58             require constant;
59             while (my ($k, $v) = each %constants) {
60             constant->import($k, dualvar(int $v, $k))
61             }
62              
63             require Exporter;
64             our @ISA = qw(Exporter);
65              
66             our @EXPORT_OK = keys %constants;
67             our %EXPORT_TAGS;
68             $EXPORT_TAGS{all} = \@EXPORT_OK;
69             $EXPORT_TAGS{fxp} = [grep /^SSH_FXP_/, @EXPORT_OK];
70             $EXPORT_TAGS{fx} = [grep /^SSH_FX_/, @EXPORT_OK];
71             $EXPORT_TAGS{filexfer} = [grep /^SSH_FILEXFER_/, @EXPORT_OK];
72             $EXPORT_TAGS{fxf} = [grep /^SSH_FXF_/, @EXPORT_OK];
73              
74             1;