line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
70797
|
use v5.12.0; |
|
2
|
|
|
|
|
19
|
|
2
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
102
|
|
3
|
|
|
|
|
|
|
package Data::Rx::Util 0.200008; |
4
|
|
|
|
|
|
|
# ABSTRACT: helper routines for Data::Rx |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
37
|
|
7
|
2
|
|
|
2
|
|
10
|
use List::Util (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
71
|
|
8
|
2
|
|
|
2
|
|
1029
|
use Number::Tolerant (); |
|
2
|
|
|
|
|
39584
|
|
|
2
|
|
|
|
|
470
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _x_subset_keys_y { |
11
|
117
|
|
|
117
|
|
247
|
my ($self, $x, $y) = @_; |
12
|
|
|
|
|
|
|
|
13
|
117
|
100
|
|
|
|
640
|
return unless keys %$x <= keys %$y; |
14
|
|
|
|
|
|
|
|
15
|
115
|
|
|
|
|
309
|
for my $key (keys %$x) { |
16
|
103
|
100
|
|
|
|
1313
|
return unless exists $y->{$key}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
107
|
|
|
|
|
387
|
return 1; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _make_range_check { |
23
|
12
|
|
|
12
|
|
464
|
my ($self, $arg) = @_; |
24
|
|
|
|
|
|
|
|
25
|
12
|
|
|
|
|
51
|
my @keys = qw(min min-ex max-ex max); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Carp::croak "unknown arguments" unless $self->_x_subset_keys_y( |
28
|
|
|
|
|
|
|
$arg, |
29
|
12
|
50
|
|
|
|
38
|
{ map {; $_ => 1 } @keys }, |
|
48
|
|
|
|
|
145
|
|
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
12
|
100
|
|
13
|
|
64
|
return sub { 1 } unless keys %$arg; |
|
13
|
|
|
|
|
53
|
|
33
|
|
|
|
|
|
|
|
34
|
11
|
|
|
|
|
24
|
my @tolerances; |
35
|
|
|
|
|
|
|
push @tolerances, Number::Tolerant->new($arg->{min} => 'or_more') |
36
|
11
|
100
|
|
|
|
59
|
if exists $arg->{min}; |
37
|
|
|
|
|
|
|
push @tolerances, Number::Tolerant->new(more_than => $arg->{'min-ex'}) |
38
|
11
|
100
|
|
|
|
115372
|
if exists $arg->{'min-ex'}; |
39
|
|
|
|
|
|
|
push @tolerances, Number::Tolerant->new($arg->{max} => 'or_less') |
40
|
11
|
50
|
|
|
|
531
|
if exists $arg->{max}; |
41
|
|
|
|
|
|
|
push @tolerances, Number::Tolerant->new(less_than => $arg->{'max-ex'}) |
42
|
11
|
100
|
|
|
|
117154
|
if exists $arg->{'max-ex'}; |
43
|
|
|
|
|
|
|
|
44
|
11
|
|
|
|
|
159
|
my $tol = do { |
45
|
2
|
|
|
2
|
|
17
|
no warnings 'once'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
317
|
|
46
|
11
|
|
|
8
|
|
117
|
List::Util::reduce { $a & $b } @tolerances; |
|
8
|
|
|
|
|
304
|
|
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
11
|
|
|
77
|
|
545
|
return sub { $_[0] == $tol }; |
|
77
|
|
|
|
|
3333
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |