line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::ShouldUpdate; |
2
|
|
|
|
|
|
|
$File::ShouldUpdate::VERSION = '0.2.1'; |
3
|
1
|
|
|
1
|
|
69962
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
493
|
use Time::HiRes qw/ stat /; |
|
1
|
|
|
|
|
1466
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
634
|
use parent 'Exporter'; |
|
1
|
|
|
|
|
293
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
49
|
use vars qw/ @EXPORT_OK /; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
273
|
|
9
|
|
|
|
|
|
|
@EXPORT_OK = qw/ should_update should_update_multi /; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub should_update_multi |
12
|
|
|
|
|
|
|
{ |
13
|
4
|
|
|
4
|
1
|
341
|
my ( $new_files, $syntax_sugar, $deps ) = @_; |
14
|
4
|
50
|
|
|
|
11
|
if ( $syntax_sugar ne ":" ) |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
|
|
0
|
die qq#wrong syntax_sugar - not ":"!#; |
17
|
|
|
|
|
|
|
} |
18
|
4
|
|
|
|
|
6
|
my $min_dep; |
19
|
4
|
|
|
|
|
7
|
foreach my $filename2 (@$new_files) |
20
|
|
|
|
|
|
|
{ |
21
|
6
|
|
|
|
|
24
|
my @stat2 = stat($filename2); |
22
|
6
|
100
|
|
|
|
150
|
if ( !@stat2 ) |
23
|
|
|
|
|
|
|
{ |
24
|
2
|
|
|
|
|
16
|
return 1; |
25
|
|
|
|
|
|
|
} |
26
|
4
|
|
|
|
|
8
|
my $new = $stat2[9]; |
27
|
4
|
100
|
66
|
|
|
18
|
if ( ( !defined $min_dep ) or ( $min_dep > $new ) ) |
28
|
|
|
|
|
|
|
{ |
29
|
3
|
|
|
|
|
8
|
$min_dep = $new; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
2
|
|
|
|
|
5
|
foreach my $d (@$deps) |
33
|
|
|
|
|
|
|
{ |
34
|
4
|
|
|
|
|
14
|
my @stat1 = stat($d); |
35
|
4
|
50
|
|
|
|
54
|
return 1 if ( $stat1[9] > $min_dep ); |
36
|
|
|
|
|
|
|
} |
37
|
2
|
|
|
|
|
40
|
return 0; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub should_update |
41
|
|
|
|
|
|
|
{ |
42
|
2
|
|
|
2
|
1
|
20290
|
my ( $filename2, $syntax_sugar, @deps ) = @_; |
43
|
2
|
50
|
|
|
|
8
|
if ( $syntax_sugar ne ":" ) |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
0
|
die qq#wrong syntax_sugar - not ":"!#; |
46
|
|
|
|
|
|
|
} |
47
|
2
|
|
|
|
|
7
|
return should_update_multi( [$filename2], $syntax_sugar, \@deps ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |