| line |
true |
false |
branch |
|
17
|
0 |
5 |
$] < 5.037 ? : |
|
76
|
1 |
5 |
!ref($_->[0]) && $_->[0] =~ /^!/ ? : |
|
115
|
12 |
8 |
$expected ? : |
|
230
|
0 |
4 |
if ref $class or $class ne "Data::Domain" |
|
234
|
2 |
2 |
ref $new_messages ? : |
|
|
0 |
4 |
unless $GLOBAL_MSGS = ref $new_messages ? $new_messages : $builtin_msgs->{$new_messages} |
|
246
|
53 |
1019 |
if (not defined $data) { } |
|
249
|
15 |
38 |
if (exists $context->{'gather_valid_data'}) |
|
251
|
4 |
9 |
&does($default, 'CODE') ? : |
|
253
|
1 |
2 |
$is_absent && exists $self->{'-if_absent'} ? : |
|
|
12 |
3 |
exists $self->{'-default'} ? : |
|
258
|
14 |
29 |
if $self->{'-optional'} or exists $self->{'-default'} or exists $self->{'-if_absent'} |
|
261
|
18 |
11 |
unless $self->isa("Data::Domain::Whatever") |
|
267
|
27 |
992 |
if exists $context->{'gather_valid_data'} |
|
270
|
2 |
1017 |
if (my $isa = $self->{'-isa'}) |
|
272
|
1 |
1 |
unless &try(sub {
$data->isa($isa);
}
) |
|
274
|
6 |
1012 |
if (my $role = $self->{'-does'}) |
|
275
|
3 |
3 |
unless &does($data, $role) |
|
278
|
3 |
1012 |
if (my $can = $self->{'-can'}) |
|
279
|
1 |
2 |
unless &does($can, "ARRAY") |
|
282
|
1 |
4 |
unless &try(sub {
$data->can($method);
}
) |
|
285
|
2 |
1012 |
if (my $match_target = $self->{'-matches'}) |
|
286
|
1 |
1 |
unless match::simple::match($data, $match_target) |
|
289
|
1 |
1012 |
if ($self->{'-has'}) |
|
292
|
1 |
0 |
if @msgs |
|
294
|
6 |
1006 |
if (defined $self->{'-blessed'}) |
|
296
|
3 |
3 |
if builtin::blessed($data) xor $self->{'-blessed'} |
|
298
|
3 |
1006 |
if (defined $self->{'-package'}) |
|
300
|
2 |
1 |
if not ref $data and $data->isa($data) xor $self->{'-package'} |
|
302
|
0 |
1007 |
if (defined $self->{'-isweak'}) |
|
304
|
0 |
0 |
if builtin::is_weak($data) xor $self->{'-isweak'} |
|
306
|
0 |
1007 |
if (defined $self->{'-readonly'}) |
|
308
|
0 |
0 |
if &Scalar::Util::readonly($data) xor $self->{'-readonly'} |
|
310
|
0 |
1007 |
if (defined $self->{'-tainted'}) |
|
312
|
0 |
0 |
if &Scalar::Util::tainted($data) xor $self->{'-tainted'} |
|
317
|
13 |
1005 |
if (defined $self->{'-true'}) |
|
319
|
6 |
7 |
if $data xor $self->{'-true'} |
|
321
|
6 |
1006 |
if (defined $self->{'-ref'}) |
|
323
|
3 |
3 |
if ref $data xor $self->{'-ref'} |
|
339
|
13 |
1 |
unless $msg |
|
350
|
1 |
2 |
&does($msg, 'HASH') ? : |
|
|
0 |
3 |
&does($msg, 'ARRAY') ? : |
|
392
|
1 |
252 |
if $USE_OLD_MSG_API |
|
399
|
11 |
242 |
if (defined $msgs) |
|
401
|
1 |
10 |
if /^CODE/ |
|
402
|
8 |
2 |
if /^$/ |
|
403
|
2 |
0 |
if (my $msg_string = $msgs->{$msg_id}) { } |
|
|
2 |
0 |
if (/^HASH/) |
|
416
|
2 |
240 |
if (ref $GLOBAL_MSGS eq 'CODE') { } |
|
421
|
0 |
240 |
unless my $msg_entry = $$GLOBAL_MSGS{$self->subclass}{$msg_id} || $Data::Domain::GLOBAL_MSGS->{'Generic'}{$msg_id} |
|
423
|
20 |
220 |
ref $msg_entry eq 'CODE' ? : |
|
461
|
1 |
2 |
&does($meth_to_call, 'ARRAY') ? : |
|
464
|
0 |
3 |
if (&does($expectation, 'ARRAY')) { } |
|
475
|
2 |
1 |
if $msg |
|
489
|
0 |
0 |
if (&does($expectation, 'ARRAY')) { } |
|
500
|
0 |
0 |
if $msg |
|
511
|
13 |
172 |
if (my $range = delete $self->{$range_field}) |
|
513
|
0 |
26 |
if defined $self->{$_} |
|
516
|
0 |
13 |
unless &does($range, "ARRAY") and @$range == 2 |
|
527
|
130 |
54 |
if ($cmp_func eq '<=') { } |
|
|
41 |
13 |
elsif ($cmp_func eq 'le') { } |
|
|
13 |
0 |
elsif (&does($cmp_func, 'CODE')) { } |
|
534
|
21 |
163 |
if (defined $min and defined $max) |
|
535
|
5 |
16 |
unless &$cmp_func($min, $max) |
|
546
|
1 |
524 |
unless @{$context->{'path'};} < $MAX_DEEP |
|
550
|
288 |
236 |
if (&does($domain, 'Data::Domain')) { } |
|
|
230 |
6 |
elsif (&does($domain, 'CODE')) { } |
|
|
6 |
0 |
elsif (not ref $domain) { } |
|
562
|
0 |
230 |
unless &does($domain, "Data::Domain") |
|
567
|
3 |
3 |
&Scalar::Util::looks_like_number($domain) ? : |
|
607
|
0 |
161 |
unless &any(sub {
$args_ref->[0] eq $_;
}
, @$options_ref, @common_options) |
|
614
|
32 |
177 |
if (@$args_ref) |
|
615
|
0 |
32 |
unless $default_option |
|
616
|
0 |
32 |
if exists $parsed{$default_option} |
|
618
|
26 |
0 |
$arg_type eq 'arrayref' ? : |
|
|
6 |
26 |
$arg_type eq 'scalar' ? : |
|
630
|
0 |
0 |
unless defined $path0 |
|
631
|
0 |
0 |
unless defined $root |
|
632
|
0 |
0 |
if &does($root, "HASH") |
|
634
|
0 |
0 |
if &does($root, "ARRAY") |
|
677
|
0 |
2 |
if $self->{'-defined'} and $self->{'-optional'} |
|
685
|
10 |
24 |
if (defined $self->{'-defined'}) |
|
687
|
6 |
4 |
if defined $data xor $self->{'-defined'} |
|
737
|
1 |
66 |
if ($self->{'-not_in'}) |
|
739
|
1 |
0 |
if @$vals > 0 |
|
740
|
0 |
1 |
unless &try(sub {
my $vals = $self->{'-not_in'};
not grep({not &looks_like_number($_);} @$vals) if @$vals > 0;
}
) |
|
749
|
107 |
214 |
unless &looks_like_number($data) |
|
752
|
32 |
182 |
if (defined $self->{'-min'}) |
|
754
|
7 |
25 |
unless $data >= $self->{'-min'} |
|
756
|
12 |
195 |
if (defined $self->{'-max'}) |
|
758
|
4 |
8 |
unless $data <= $self->{'-max'} |
|
760
|
5 |
198 |
if (defined $self->{'-not_in'}) |
|
761
|
2 |
3 |
if grep {$data == $_;} @{$$self{"-not_in"};} |
|
780
|
25 |
79 |
unless defined $data and $data =~ /^-?\d+$/ |
|
797
|
1 |
2 |
unless defined $data and $data =~ /^\d+$/ |
|
833
|
3 |
171 |
unless not ref $data or overload::Method($data, "\"\"") |
|
835
|
6 |
165 |
if ($self->{'-min_length'}) |
|
837
|
1 |
5 |
unless length $data >= $self->{'-min_length'} |
|
839
|
5 |
165 |
if (defined $self->{'-max_length'}) |
|
841
|
3 |
2 |
unless length $data <= $self->{'-max_length'} |
|
843
|
133 |
34 |
if ($self->{'-regex'}) |
|
845
|
13 |
120 |
unless $data =~ /$self->{'-regex'}/ |
|
847
|
2 |
152 |
if ($self->{'-antiregex'}) |
|
849
|
1 |
1 |
if $data =~ /$self->{'-antiregex'}/ |
|
851
|
4 |
149 |
if (defined $self->{'-min'}) |
|
853
|
1 |
3 |
unless $data ge $self->{'-min'} |
|
855
|
3 |
149 |
if (defined $self->{'-max'}) |
|
857
|
1 |
2 |
unless $data le $self->{'-max'} |
|
859
|
1 |
150 |
if ($self->{'-not_in'}) |
|
860
|
0 |
1 |
if grep {$data eq $_;} @{$$self{"-not_in"};} |
|
897
|
7 |
35 |
unless (ref $date) |
|
902
|
0 |
7 |
unless $date = {"today", [Today()], "yesterday", [Add_Delta_Days(Today(), -1)], "tomorrow", [Add_Delta_Days(Today(), 1)]}->{$date} |
|
919
|
0 |
1 |
if ref $class |
|
925
|
1 |
0 |
ref $new_parser eq 'CODE' ? : |
|
|
0 |
1 |
unless $date_parser = ref $new_parser eq "CODE" ? $new_parser : {"US", \&Data::Domain::Date::Decode_Date_US, "EU", \&Data::Domain::Date::Decode_Date_EU}->{$new_parser} |
|
941
|
6 |
15 |
if ($self->{$bound} and not $self->{$bound} =~ /$dynamic_date/) |
|
942
|
1 |
5 |
unless my(@date) = &$date_parser($self->{$bound}) |
|
952
|
1 |
8 |
if ($self->{'-not_in'}) |
|
956
|
1 |
1 |
if ($date =~ /$dynamic_date/) { } |
|
960
|
0 |
1 |
unless my(@parsed_date) = &$date_parser($date) |
|
966
|
0 |
1 |
unless &try(sub {
foreach my $date (@{$$self{"-not_in"};}) {
if ($date =~ /$dynamic_date/) {
push @excl_dates, $date;
}
else {
die "wrong date" unless my(@parsed_date) = &$date_parser($date);
push @excl_dates, \@parsed_date;
};
};
@excl_dates > 0;
}
) |
|
978
|
4 |
14 |
unless @date and check_date(@date) |
|
981
|
6 |
8 |
if (defined $self->{'-min'}) |
|
984
|
2 |
4 |
if not check_date(@$min) or _date_cmp(\@date, $min) < 0 |
|
987
|
3 |
9 |
if (defined $self->{'-max'}) |
|
990
|
1 |
2 |
if not check_date(@$max) or _date_cmp(\@date, $max) > 0 |
|
993
|
2 |
9 |
if ($self->{'-not_in'}) |
|
994
|
1 |
1 |
if grep {_date_cmp(\@date, $_) == 0;} @{$$self{"-not_in"};} |
|
1022
|
0 |
16 |
unless (ref $time) |
|
1023
|
0 |
0 |
unless $time eq "now" |
|
1040
|
2 |
4 |
unless $_ |
|
1054
|
4 |
2 |
if ($self->{$bound} and $self->{$bound} ne "now") |
|
1056
|
0 |
4 |
unless @time and _valid_time(@time) |
|
1073
|
2 |
4 |
unless @t and _valid_time(@t) |
|
1076
|
3 |
1 |
if (defined $self->{'-min'}) |
|
1078
|
1 |
2 |
if _time_cmp(\@t, $self->{'-min'}) < 0 |
|
1081
|
2 |
1 |
if (defined $self->{'-max'}) |
|
1083
|
1 |
1 |
if _time_cmp(\@t, $self->{'-max'}) > 0 |
|
1108
|
1 |
2 |
unless &Scalar::Util::openhandle($data) |
|
1132
|
0 |
5 |
unless &try(sub {
@{$self->{'-values'};};
}
) |
|
1134
|
1 |
4 |
if grep {not defined $_;} @{$$self{"-values"};} |
|
1145
|
2 |
4 |
unless grep {$_ eq $data;} @{$$self{"-values"};} |
|
1170
|
10 |
10 |
if ($self->{'-items'}) |
|
1171
|
0 |
10 |
unless &does($self->{'-items'}, "ARRAY") |
|
1177
|
0 |
20 |
if $self->{$bound} and $self->{$bound} < @{$self->{'-items'};} |
|
1182
|
0 |
10 |
if @invalid_fields |
|
1187
|
12 |
28 |
if (my $dom = $self->{$arg}) |
|
1188
|
11 |
1 |
unless &does($dom, "ARRAY") |
|
1189
|
1 |
12 |
unless &does($_, "Data::Domain") |
|
|
0 |
12 |
unless &all(sub {
&does($_, "CODE") unless &does($_, "Data::Domain");
}
, @$dom) |
|
1202
|
1 |
45 |
unless &does($data, "ARRAY") |
|
1207
|
4 |
41 |
if exists $context->{'gather_valid_data'} |
|
1210
|
1 |
44 |
if (defined $self->{'-min_size'} and @$data < $self->{'-min_size'}) |
|
1214
|
1 |
43 |
if (defined $self->{'-max_size'} and @$data > $self->{'-max_size'}) |
|
1218
|
2 |
6 |
unless $self->{'-items'} or $self->{'-all'} or $self->{'-any'} |
|
1233
|
0 |
67 |
unless my $subdomain = $self->_build_subdomain($items->[$i], $context) |
|
1239
|
8 |
59 |
if exists $context->{'gather_valid_data'} |
|
1243
|
12 |
29 |
if (my $all = $self->{'-all'}) |
|
1244
|
12 |
0 |
unless &does($all, "ARRAY") |
|
1256
|
2 |
31 |
if exists $context->{'gather_valid_data'} and not defined $valid_data[$i] |
|
1261
|
11 |
30 |
if $has_invalid |
|
1264
|
13 |
17 |
if (my $any = $self->{'-any'}) |
|
1265
|
9 |
4 |
unless &does($any, "ARRAY") |
|
1268
|
1 |
12 |
unless $n_data > $n_items |
|
1279
|
11 |
20 |
unless $error |
|
1286
|
4 |
21 |
if exists $context->{'gather_valid_data'} |
|
1317
|
23 |
2 |
if (&does($fields, 'ARRAY')) { } |
|
|
2 |
0 |
elsif (&does($fields, 'HASH')) { } |
|
1337
|
0 |
25 |
if @invalid_fields |
|
1341
|
42 |
8 |
unless my $val = $self->{$opt} |
|
1342
|
0 |
6 |
unless &does($val, "ARRAY") or &does($val, "Regexp") or not ref $val |
|
1348
|
2 |
48 |
if (my $dom = $self->{$arg}) |
|
1349
|
0 |
2 |
unless &does($dom, "Data::Domain::List") or &does($dom, "CODE") |
|
1363
|
2 |
149 |
unless &does($data, "HASH") |
|
1370
|
6 |
143 |
if exists $context->{'gather_valid_data'} |
|
1374
|
12 |
137 |
if (my $exclude = $self->{'-exclude'}) |
|
1377
|
8 |
4 |
if @wrong_fields |
|
1387
|
8 |
388 |
if not exists $data->{$field} and $self->_field_matches("-may_ignore", $field) |
|
1392
|
17 |
271 |
if $msg |
|
1395
|
15 |
273 |
if exists $context->{'gather_valid_data'} |
|
1399
|
3 |
46 |
if (my $keys_dom = $self->{'-keys'}) |
|
1403
|
1 |
2 |
if $msg |
|
1407
|
3 |
46 |
if (my $values_dom = $self->{'-values'}) |
|
1411
|
1 |
2 |
if $msg |
|
1415
|
6 |
43 |
if exists $context->{'gather_valid_data'} |
|
1417
|
20 |
29 |
keys %msgs ? : |
|
1453
|
1 |
2 |
if exists $self->{'-exclude'} |
|
1474
|
0 |
2 |
unless &Scalar::Does::does($self->{'-options'}, "ARRAY") |
|
1487
|
109 |
112 |
unless my $msg = $subdomain->inspect($data, $context) |
|
1523
|
0 |
2 |
unless &Scalar::Does::does($self->{'-options'}, "ARRAY") |
|
1537
|
2 |
6 |
if $msg |
|
1539
|
2 |
2 |
@msgs ? : |