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