File Coverage

blib/lib/Win32/FileSystem/Watcher/Constants.pm
Criterion Covered Total %
statement 86 86 100.0
branch n/a
condition n/a
subroutine 30 30 100.0
pod 0 2 0.0
total 116 118 98.3


line stmt bran cond sub pod time code
1             package Win32::FileSystem::Watcher::Constants;
2            
3 1     1   5 use strict;
  1         3  
  1         30  
4 1     1   6 use warnings;
  1         2  
  1         280  
5            
6             require Exporter;
7             our @ISA = qw(Exporter);
8            
9             sub FILE_NOTIFICATION_CONSTANTS {
10             return {
11 1     1 0 14 FILE_NOTIFY_CHANGE_FILE_NAME => 0x00000001,
12             FILE_NOTIFY_CHANGE_DIR_NAME => 0x00000002,
13             FILE_NOTIFY_CHANGE_ATTRIBUTES => 0x00000004,
14             FILE_NOTIFY_CHANGE_SIZE => 0x00000008,
15             FILE_NOTIFY_CHANGE_LAST_WRITE => 0x00000010,
16             FILE_NOTIFY_CHANGE_LAST_ACCESS => 0x00000020,
17             FILE_NOTIFY_CHANGE_CREATION => 0x00000040,
18             FILE_NOTIFY_CHANGE_SECURITY => 0x00000100,
19             FILE_NOTIFY_ALL => 0x17F,
20             };
21             }
22            
23             sub FILE_ACTION_CONSTANTS {
24             return {
25 2     2 0 24 FILE_ACTION_ADDED => 0x00000001,
26             FILE_ACTION_REMOVED => 0x00000002,
27             FILE_ACTION_MODIFIED => 0x00000003,
28             FILE_ACTION_RENAMED_OLD_NAME => 0x00000004,
29             FILE_ACTION_RENAMED_NEW_NAME => 0x00000005,
30             };
31             }
32            
33             my $constants = {
34             %{&FILE_NOTIFICATION_CONSTANTS},
35             %{&FILE_ACTION_CONSTANTS},
36             INVALID_HANDLE_VALUE => -1,
37             INFINITE => -1,
38             NULL => 0,
39            
40             WAIT_FAILED => -1,
41             WAIT_OBJECT_0 => 0,
42             WAIT_TIMEOUT => 0x00000102,
43            
44             FILE_SHARE_READ => 0x00000001,
45             FILE_SHARE_WRITE => 0x00000002,
46             FILE_SHARE_DELETE => 0x00000004,
47            
48             OPEN_EXISTING => 3,
49             FILE_FLAG_BACKUP_SEMANTICS => 0x02000000,
50             FILE_LIST_DIRECTORY => 0x0001,
51             };
52            
53             foreach ( keys %$constants ) {
54 1     1   6 eval "use constant $_ => $constants->{$_};";
  1     1   2  
  1     1   66  
  1     1   5  
  1     1   2  
  1     1   52  
  1     1   6  
  1     1   2  
  1     1   35  
  1     1   5  
  1     1   2  
  1     1   39  
  1     1   6  
  1     1   2  
  1     1   38  
  1     1   5  
  1     1   2  
  1     1   33  
  1     1   5  
  1     1   2  
  1     1   32  
  1     1   6  
  1     1   1  
  1     1   32  
  1     1   5  
  1     1   1  
  1         31  
  1         5  
  1         2  
  1         38  
  1         5  
  1         2  
  1         32  
  1         5  
  1         2  
  1         32  
  1         6  
  1         2  
  1         30  
  1         5  
  1         2  
  1         33  
  1         5  
  1         2  
  1         32  
  1         5  
  1         2  
  1         31  
  1         6  
  1         2  
  1         36  
  1         5  
  1         108  
  1         35  
  1         6  
  1         2  
  1         36  
  1         6  
  1         1  
  1         35  
  1         5  
  1         2  
  1         39  
  1         5  
  1         2  
  1         37  
  1         6  
  1         2  
  1         32  
  1         5  
  1         2  
  1         31  
  1         6  
  1         2  
  1         32  
  1         5  
  1         2  
  1         31  
55             }
56            
57             our @EXPORT = (
58             keys %$constants,
59             qw( FILE_NOTIFICATION_CONSTANTS FILE_ACTION_CONSTANTS)
60             );
61            
62             1;