line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Win32::FileSystem::Watcher::Change;
|
2
|
1
|
|
|
1
|
|
31000
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
6
|
use Carp;
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
95
|
|
5
|
1
|
|
|
1
|
|
586
|
use Win32::FileSystem::Watcher::Constants;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
647
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new {
|
8
|
0
|
|
|
0
|
0
|
0
|
my ( $pkg, $action, $file_name ) = @_;
|
9
|
0
|
0
|
0
|
|
|
0
|
unless ( defined($action) && defined($file_name) && $file_name ne '' ) {
|
|
|
|
0
|
|
|
|
|
10
|
0
|
|
|
|
|
0
|
croak "need an action and a file name.";
|
11
|
|
|
|
|
|
|
}
|
12
|
0
|
0
|
|
|
|
0
|
unless ( defined action_id_to_name->($action) ) {
|
13
|
0
|
|
|
|
|
0
|
croak "Invalid action ID.";
|
14
|
|
|
|
|
|
|
}
|
15
|
0
|
|
|
|
|
0
|
my $obj = \"$action $file_name";
|
16
|
0
|
|
|
|
|
0
|
bless $obj, $pkg;
|
17
|
0
|
|
|
|
|
0
|
return $obj;
|
18
|
|
|
|
|
|
|
}
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub file_name {
|
21
|
0
|
0
|
|
0
|
0
|
0
|
${ $_[0] } =~ m/^\d+ (.*)/ ? $1 : undef;
|
|
0
|
|
|
|
|
0
|
|
22
|
|
|
|
|
|
|
}
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub action_id {
|
25
|
0
|
0
|
|
0
|
0
|
0
|
${ $_[0] } =~ m/^(\d+)/ ? $1 : undef;
|
|
0
|
|
|
|
|
0
|
|
26
|
|
|
|
|
|
|
}
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub action_name {
|
29
|
0
|
|
|
0
|
0
|
0
|
return action_id_to_name( $_[0]->action_id );
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Class, Static, Utility methods
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
{
|
35
|
|
|
|
|
|
|
my $action_name_to_id = FILE_ACTION_CONSTANTS;
|
36
|
|
|
|
|
|
|
my $action_id_to_name = _reverse_hashref($action_name_to_id);
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub action_id_to_name {
|
39
|
0
|
0
|
|
0
|
0
|
0
|
shift if ref( $_[0] );
|
40
|
0
|
0
|
|
|
|
0
|
if ( exists $action_id_to_name->{ $_[0] } ) {
|
41
|
0
|
|
|
|
|
0
|
return $action_id_to_name->{ $_[0] };
|
42
|
|
|
|
|
|
|
} else {
|
43
|
0
|
|
|
|
|
0
|
return undef;
|
44
|
|
|
|
|
|
|
}
|
45
|
|
|
|
|
|
|
}
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub action_name_to_id {
|
48
|
0
|
0
|
|
0
|
0
|
0
|
shift if ref( $_[0] );
|
49
|
0
|
0
|
|
|
|
0
|
if ( exists $action_name_to_id->{ $_[0] } ) {
|
50
|
0
|
|
|
|
|
0
|
return $action_name_to_id->{ $_[0] };
|
51
|
|
|
|
|
|
|
} else {
|
52
|
0
|
|
|
|
|
0
|
return undef;
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _reverse_hashref {
|
58
|
1
|
|
|
1
|
|
2
|
my $hash = shift;
|
59
|
1
|
|
|
|
|
7
|
return { map { $hash->{$_} => $_ } keys %$hash };
|
|
5
|
|
|
|
|
14
|
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1;
|