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