line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Array::Contains; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
57969
|
use 5.020; |
|
3
|
|
|
|
|
11
|
|
4
|
3
|
|
|
3
|
|
11
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
56
|
|
5
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
87
|
|
6
|
3
|
|
|
3
|
|
1670
|
use diagnostics; |
|
3
|
|
|
|
|
448985
|
|
|
3
|
|
|
|
|
33
|
|
7
|
3
|
|
|
3
|
|
3303
|
use mro 'c3'; |
|
3
|
|
|
|
|
2440
|
|
|
3
|
|
|
|
|
26
|
|
8
|
3
|
|
|
3
|
|
1640
|
use English; |
|
3
|
|
|
|
|
10535
|
|
|
3
|
|
|
|
|
18
|
|
9
|
|
|
|
|
|
|
our $VERSION = 2.7; # Based on Maplat version this was tested against |
10
|
3
|
|
|
3
|
|
1405
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
654
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Exporter; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT = qw(contains); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub contains { |
19
|
10
|
|
|
10
|
1
|
1271
|
my ($value, $dataset) = @_; |
20
|
|
|
|
|
|
|
|
21
|
10
|
100
|
|
|
|
29
|
if(!defined($value)) { |
22
|
1
|
|
|
|
|
77
|
croak('value is not defined in contains()'); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
9
|
100
|
|
|
|
17
|
if(!defined($dataset)) { |
26
|
2
|
|
|
|
|
342
|
croak('dataset is not defined in contains()'); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
7
|
100
|
|
|
|
28
|
if(ref($value) ne '') { |
30
|
1
|
|
|
|
|
79
|
croak('value is not a scalar in contains()'); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
6
|
100
|
|
|
|
20
|
if(ref($dataset) ne 'ARRAY') { |
34
|
2
|
|
|
|
|
214
|
croak('dataset is not an array reference in contains()'); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
7
|
foreach my $key (@{$dataset}) { |
|
4
|
|
|
|
|
10
|
|
38
|
28
|
50
|
|
|
|
47
|
next if(ref($key) ne ''); |
39
|
28
|
100
|
|
|
|
47
|
if($value eq $key) { |
40
|
2
|
|
|
|
|
14
|
return 1; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
10
|
return 0; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
__END__ |