line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::ChangeNotify; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
81827
|
use strict; |
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
50
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
43
|
|
5
|
2
|
|
|
2
|
|
471
|
use namespace::autoclean; |
|
2
|
|
|
|
|
33443
|
|
|
2
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
148
|
use Carp qw( confess ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
97
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# We load this up front to make sure that the prereq modules are installed. |
12
|
2
|
|
|
2
|
|
509
|
use File::ChangeNotify::Watcher::Default; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
76
|
|
13
|
2
|
|
|
2
|
|
522
|
use Module::Pluggable::Object; |
|
2
|
|
|
|
|
14336
|
|
|
2
|
|
|
|
|
67
|
|
14
|
2
|
|
|
2
|
|
14
|
use Module::Runtime qw( use_module ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# First version to support coerce => 1 |
17
|
2
|
|
|
2
|
|
98
|
use Moo 1.006 (); |
|
2
|
|
|
|
|
46
|
|
|
2
|
|
|
|
|
604
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub instantiate_watcher { |
20
|
3
|
|
|
3
|
1
|
1018
|
my $class = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
11
|
my @usable = $class->usable_classes; |
23
|
3
|
50
|
|
|
|
21
|
return $usable[0]->new(@_) if @usable; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
60
|
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; |
32
|
|
|
|
|
|
|
my @usable_classes; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub usable_classes { |
35
|
4
|
100
|
|
4
|
1
|
147
|
return @usable_classes if $loaded; |
36
|
4
|
|
|
|
|
11
|
@usable_classes = grep { _try_load($_) } |
37
|
2
|
|
|
|
|
14
|
sort grep { $_ ne 'File::ChangeNotify::Watcher::Default' } |
|
6
|
|
|
|
|
6047
|
|
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
|
|
9
|
my $module = shift; |
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
9
|
my $ok = eval { use_module($module) }; |
|
4
|
|
|
|
|
15
|
|
49
|
4
|
|
|
|
|
1432
|
my $e = $@; |
50
|
4
|
50
|
|
|
|
15
|
return $module if $ok; |
51
|
|
|
|
|
|
|
|
52
|
4
|
50
|
33
|
|
|
59
|
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__ |