| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Flower::Chronos::Utils; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
20275
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
52
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
59
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9
|
use base 'Exporter'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
221
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw(are_hashes_equal parse_time); |
|
9
|
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
831
|
use Time::Piece; |
|
|
2
|
|
|
|
|
14801
|
|
|
|
2
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub are_hashes_equal { |
|
13
|
6
|
|
|
6
|
0
|
7798
|
my ($first, $second) = @_; |
|
14
|
|
|
|
|
|
|
|
|
15
|
6
|
|
|
|
|
18
|
foreach my $key (keys %$first) { |
|
16
|
5
|
100
|
100
|
|
|
40
|
if (defined $first->{$key} && defined $second->{$key}) { |
|
|
|
100
|
66
|
|
|
|
|
|
17
|
2
|
100
|
|
|
|
7
|
if ($first->{$key} ne $second->{$key}) { |
|
18
|
1
|
|
|
|
|
5
|
return 0; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
elsif (!defined $first->{$key} && !defined $second->{$key}) { |
|
22
|
1
|
|
|
|
|
3
|
next; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
else { |
|
25
|
2
|
|
|
|
|
11
|
return 0; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
3
|
|
|
|
|
11
|
return 1; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub parse_time { |
|
33
|
18
|
|
|
18
|
0
|
3559
|
my ($string) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
18
|
100
|
|
|
|
87
|
return $string if $string =~ m/^\d+$/; |
|
36
|
|
|
|
|
|
|
|
|
37
|
16
|
|
|
|
|
30
|
my $format = '%Y-%m-%d'; |
|
38
|
16
|
100
|
|
|
|
45
|
if ($string =~ m/ \d\d:\d\d:\d\d$/) { |
|
39
|
3
|
|
|
|
|
6
|
$format .= ' %T'; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
16
|
|
|
|
|
74
|
return Time::Piece->strptime($string, $format)->epoch; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |