line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::ChangeNotify; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
79000
|
use strict; |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
58
|
|
5
|
2
|
|
|
2
|
|
490
|
use namespace::autoclean; |
|
2
|
|
|
|
|
36598
|
|
|
2
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.29'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
159
|
use Carp qw( confess ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
96
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# We load this up front to make sure that the prereq modules are installed. |
12
|
2
|
|
|
2
|
|
465
|
use File::ChangeNotify::Watcher::Default; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
107
|
|
13
|
2
|
|
|
2
|
|
498
|
use Module::Pluggable::Object; |
|
2
|
|
|
|
|
15656
|
|
|
2
|
|
|
|
|
74
|
|
14
|
2
|
|
|
2
|
|
15
|
use Module::Runtime qw( use_module ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# First version to support coerce => 1 |
17
|
2
|
|
|
2
|
|
100
|
use Moo 1.006 (); |
|
2
|
|
|
|
|
65
|
|
|
2
|
|
|
|
|
589
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub instantiate_watcher { |
20
|
3
|
|
|
3
|
1
|
654
|
my $class = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
11
|
my @usable = $class->usable_classes(); |
23
|
3
|
50
|
|
|
|
9
|
return $usable[0]->new(@_) if @usable; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
74
|
return File::ChangeNotify::Watcher::Default->new(@_); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
my $finder = Module::Pluggable::Object->new( |
30
|
|
|
|
|
|
|
search_path => 'File::ChangeNotify::Watcher' ); |
31
|
|
|
|
|
|
|
my $loaded = 0; |
32
|
|
|
|
|
|
|
my @usable_classes = (); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub usable_classes { |
35
|
4
|
100
|
|
4
|
1
|
202
|
return @usable_classes if $loaded; |
36
|
4
|
|
|
|
|
12
|
@usable_classes = grep { _try_load($_) } |
37
|
2
|
|
|
|
|
12
|
sort grep { $_ ne 'File::ChangeNotify::Watcher::Default' } |
|
6
|
|
|
|
|
6357
|
|
38
|
|
|
|
|
|
|
$finder->plugins(); |
39
|
2
|
|
|
|
|
6
|
$loaded = 1; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
6
|
return @usable_classes; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _try_load { |
46
|
4
|
|
|
4
|
|
11
|
my $module = shift; |
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
7
|
my $ok = eval { use_module($module) }; |
|
4
|
|
|
|
|
13
|
|
49
|
4
|
|
|
|
|
1130
|
my $e = $@; |
50
|
4
|
50
|
|
|
|
15
|
return $module if $ok; |
51
|
|
|
|
|
|
|
|
52
|
4
|
50
|
33
|
|
|
54
|
die $e |
53
|
|
|
|
|
|
|
if $e |
54
|
|
|
|
|
|
|
&& $e !~ /Can\'t locate|did not return a true value/; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# ABSTRACT: Watch for changes to files, cross-platform style |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |