line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::ChangeNotify; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
91564
|
use strict; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
55
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
5
|
2
|
|
|
2
|
|
487
|
use namespace::autoclean; |
|
2
|
|
|
|
|
35496
|
|
|
2
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.31'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
158
|
use Carp qw( confess ); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
109
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# We load this up front to make sure that the prereq modules are installed. |
12
|
2
|
|
|
2
|
|
603
|
use File::ChangeNotify::Watcher::Default; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
105
|
|
13
|
2
|
|
|
2
|
|
710
|
use Module::Pluggable::Object; |
|
2
|
|
|
|
|
15432
|
|
|
2
|
|
|
|
|
147
|
|
14
|
2
|
|
|
2
|
|
24
|
use Module::Runtime qw( use_module ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# First version to support coerce => 1 |
17
|
2
|
|
|
2
|
|
113
|
use Moo 1.006 (); |
|
2
|
|
|
|
|
61
|
|
|
2
|
|
|
|
|
586
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub instantiate_watcher { |
20
|
3
|
|
|
3
|
1
|
646
|
my $class = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
10
|
my @usable = $class->usable_classes; |
23
|
3
|
50
|
|
|
|
22
|
return $usable[0]->new(@_) if @usable; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
58
|
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
|
136
|
return @usable_classes if $loaded; |
36
|
4
|
|
|
|
|
15
|
@usable_classes = grep { _try_load($_) } |
37
|
2
|
|
|
|
|
16
|
sort grep { $_ ne 'File::ChangeNotify::Watcher::Default' } |
|
6
|
|
|
|
|
5622
|
|
38
|
|
|
|
|
|
|
$finder->plugins; |
39
|
2
|
|
|
|
|
5
|
$loaded = 1; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
8
|
return @usable_classes; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _try_load { |
46
|
4
|
|
|
4
|
|
8
|
my $module = shift; |
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
7
|
my $ok = eval { use_module($module) }; |
|
4
|
|
|
|
|
16
|
|
49
|
4
|
|
|
|
|
1634
|
my $e = $@; |
50
|
4
|
50
|
|
|
|
14
|
return $module if $ok; |
51
|
|
|
|
|
|
|
|
52
|
4
|
50
|
33
|
|
|
50
|
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__ |