line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package List::AllUtils::ContainsNull; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2021-07-05'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'List-AllUtils-Null'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
73072
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
62
|
|
9
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
10
|
use Exporter 'import'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1043
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw(max maxstr min minstr sum); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub sum(@) { |
15
|
10
|
|
|
10
|
1
|
19
|
my $contains_null = 0; |
16
|
10
|
100
|
|
|
|
36
|
return (undef, 0) unless @_; |
17
|
8
|
|
|
|
|
13
|
my $sum; |
18
|
8
|
|
|
|
|
17
|
for (@_) { |
19
|
26
|
100
|
|
|
|
49
|
unless (defined) { $contains_null = 1; next } |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
17
|
|
20
|
18
|
100
|
|
|
|
35
|
if (defined $sum) { $sum += $_ } else { $sum = $_ } |
|
14
|
|
|
|
|
21
|
|
|
4
|
|
|
|
|
7
|
|
21
|
|
|
|
|
|
|
} |
22
|
8
|
|
|
|
|
69
|
($sum, $contains_null); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub min (@) { |
26
|
10
|
|
|
10
|
1
|
20
|
my $contains_null = 0; |
27
|
10
|
100
|
|
|
|
37
|
return (undef, 0) unless @_; |
28
|
8
|
|
|
|
|
14
|
my $min; |
29
|
8
|
|
|
|
|
18
|
for (@_) { |
30
|
26
|
100
|
|
|
|
50
|
unless (defined) { $contains_null = 1; next } |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
15
|
|
31
|
18
|
50
|
|
|
|
34
|
if (defined $min) { $min = $_ if $_ < $min } else { $min = $_ } |
|
14
|
100
|
|
|
|
31
|
|
|
4
|
|
|
|
|
8
|
|
32
|
|
|
|
|
|
|
} |
33
|
8
|
|
|
|
|
40
|
($min, $contains_null); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub max (@) { |
37
|
10
|
|
|
10
|
1
|
189
|
my $contains_null = 0; |
38
|
10
|
100
|
|
|
|
43
|
return (undef, 0) unless @_; |
39
|
8
|
|
|
|
|
15
|
my $max; |
40
|
8
|
|
|
|
|
16
|
for (@_) { |
41
|
26
|
100
|
|
|
|
50
|
unless (defined) { $contains_null = 1; next } |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
16
|
|
42
|
18
|
50
|
|
|
|
38
|
if (defined $max) { $max = $_ if $_ > $max } else { $max = $_ } |
|
14
|
100
|
|
|
|
31
|
|
|
4
|
|
|
|
|
7
|
|
43
|
|
|
|
|
|
|
} |
44
|
8
|
|
|
|
|
41
|
($max, $contains_null); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub minstr (@) { |
48
|
10
|
|
|
10
|
1
|
21
|
my $contains_null = 0; |
49
|
10
|
100
|
|
|
|
36
|
return (undef, 0) unless @_; |
50
|
8
|
|
|
|
|
14
|
my $min; |
51
|
8
|
|
|
|
|
18
|
for (@_) { |
52
|
26
|
100
|
|
|
|
47
|
unless (defined) { $contains_null = 1; next } |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
15
|
|
53
|
18
|
50
|
|
|
|
39
|
if (defined $min) { $min = $_ if $_ lt $min } else { $min = $_ } |
|
14
|
100
|
|
|
|
31
|
|
|
4
|
|
|
|
|
8
|
|
54
|
|
|
|
|
|
|
} |
55
|
8
|
|
|
|
|
48
|
($min, $contains_null); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub maxstr (@) { |
59
|
10
|
|
|
10
|
1
|
23
|
my $contains_null = 0; |
60
|
10
|
100
|
|
|
|
34
|
return (undef, 0) unless @_; |
61
|
8
|
|
|
|
|
15
|
my $max; |
62
|
8
|
|
|
|
|
18
|
for (@_) { |
63
|
26
|
100
|
|
|
|
53
|
unless (defined) { $contains_null = 1; next } |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
15
|
|
64
|
18
|
50
|
|
|
|
43
|
if (defined $max) { $max = $_ if $_ gt $max } else { $max = $_ } |
|
14
|
100
|
|
|
|
37
|
|
|
4
|
|
|
|
|
9
|
|
65
|
|
|
|
|
|
|
} |
66
|
8
|
|
|
|
|
43
|
($max, $contains_null); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
# ABSTRACT: List subroutines that return additional result: "contains-null/not" |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |