| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package List::AllUtils::Null; |
|
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
|
|
74080
|
use strict; |
|
|
2
|
|
|
|
|
13
|
|
|
|
2
|
|
|
|
|
58
|
|
|
9
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
51
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
9
|
use Exporter 'import'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
764
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw(max maxstr min minstr sum); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub sum(@) { |
|
15
|
4
|
50
|
|
4
|
1
|
15
|
return undef unless @_; |
|
16
|
4
|
|
|
|
|
6
|
my $s = 0; |
|
17
|
4
|
|
|
|
|
9
|
for (@_) { |
|
18
|
16
|
100
|
|
|
|
33
|
return undef unless defined; |
|
19
|
14
|
|
|
|
|
20
|
$s += $_; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
2
|
|
|
|
|
5
|
$s; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub min (@) { |
|
25
|
4
|
50
|
|
4
|
1
|
15
|
return undef unless @_; |
|
26
|
4
|
|
|
|
|
8
|
my $min = shift; |
|
27
|
4
|
50
|
|
|
|
11
|
return undef unless defined $min; |
|
28
|
4
|
|
|
|
|
17
|
for (@_) { |
|
29
|
12
|
100
|
|
|
|
30
|
return undef unless defined; |
|
30
|
10
|
50
|
|
|
|
21
|
$_ < $min and $min = $_; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
2
|
|
|
|
|
6
|
$min; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub max (@) { |
|
36
|
4
|
50
|
|
4
|
1
|
173
|
return undef unless @_; |
|
37
|
4
|
|
|
|
|
8
|
my $max = shift; |
|
38
|
4
|
50
|
|
|
|
10
|
return undef unless defined $max; |
|
39
|
4
|
|
|
|
|
11
|
for (@_) { |
|
40
|
12
|
100
|
|
|
|
23
|
return undef unless defined; |
|
41
|
10
|
50
|
|
|
|
24
|
$_ > $max and $max = $_; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
2
|
|
|
|
|
10
|
$max; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub minstr (@) { |
|
47
|
4
|
50
|
|
4
|
1
|
12
|
return undef unless @_; |
|
48
|
4
|
|
|
|
|
9
|
my $min = shift; |
|
49
|
4
|
50
|
|
|
|
10
|
return undef unless defined $min; |
|
50
|
4
|
|
|
|
|
10
|
for (@_) { |
|
51
|
12
|
100
|
|
|
|
27
|
return undef unless defined; |
|
52
|
10
|
50
|
|
|
|
19
|
$_ lt $min and $min = $_; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
2
|
|
|
|
|
7
|
$min; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub maxstr (@) { |
|
58
|
4
|
50
|
|
4
|
1
|
14
|
return undef unless @_; |
|
59
|
4
|
|
|
|
|
9
|
my $max = shift; |
|
60
|
4
|
50
|
|
|
|
10
|
return undef unless defined $max; |
|
61
|
4
|
|
|
|
|
11
|
for (@_) { |
|
62
|
12
|
100
|
|
|
|
38
|
return undef unless defined; |
|
63
|
10
|
50
|
|
|
|
28
|
$_ gt $max and $max = $_; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
2
|
|
|
|
|
8
|
$max; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
# ABSTRACT: List subroutines that treat undef as contagious unknown, like null in SQL |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |