| line |
true |
false |
branch |
|
15
|
4 |
0 |
$] < 5.037 ? : |
|
73
|
1 |
4 |
!ref($_->[0]) && $_->[0] =~ /^!/ ? : |
|
214
|
0 |
3 |
if ref $class or $class ne "Data::Domain" |
|
218
|
1 |
2 |
ref $new_messages ? : |
|
|
0 |
3 |
unless $global_msgs = ref $new_messages ? $new_messages : $builtin_msgs->{$new_messages} |
|
227
|
33 |
949 |
if (not defined $data) { } |
|
229
|
7 |
26 |
if $self->{'-optional'} |
|
232
|
17 |
9 |
unless $self->isa("Data::Domain::Whatever") |
|
237
|
2 |
947 |
if (my $isa = $self->{'-isa'}) |
|
239
|
1 |
1 |
unless &try(sub {
$data->isa($isa);
}
) |
|
241
|
4 |
944 |
if (my $role = $self->{'-does'}) |
|
242
|
2 |
2 |
unless &does($data, $role) |
|
245
|
3 |
943 |
if (my $can = $self->{'-can'}) |
|
246
|
1 |
2 |
unless &does($can, "ARRAY") |
|
249
|
1 |
4 |
unless &try(sub {
$data->can($method);
}
) |
|
252
|
2 |
943 |
if (my $match_target = $self->{'-matches'}) |
|
253
|
1 |
1 |
unless match::simple::match($data, $match_target) |
|
256
|
1 |
943 |
if ($self->{'-has'}) |
|
259
|
1 |
0 |
if @msgs |
|
261
|
8 |
935 |
if (defined $self->{'-blessed'}) |
|
263
|
4 |
4 |
if &Scalar::Util::blessed($data) xor $self->{'-blessed'} |
|
265
|
3 |
936 |
if (defined $self->{'-package'}) |
|
267
|
2 |
1 |
if not ref $data and $data->isa($data) xor $self->{'-package'} |
|
269
|
0 |
937 |
if (defined $self->{'-isweak'}) |
|
271
|
0 |
0 |
if &Scalar::Util::isweak($data) xor $self->{'-isweak'} |
|
273
|
0 |
937 |
if (defined $self->{'-readonly'}) |
|
275
|
0 |
0 |
if &Scalar::Util::readonly($data) xor $self->{'-readonly'} |
|
277
|
0 |
937 |
if (defined $self->{'-tainted'}) |
|
279
|
0 |
0 |
if &Scalar::Util::readonly($data) xor $self->{'-tainted'} |
|
284
|
11 |
935 |
if (defined $self->{'-true'}) |
|
286
|
5 |
6 |
if $data xor $self->{'-true'} |
|
288
|
6 |
935 |
if (defined $self->{'-ref'}) |
|
290
|
3 |
3 |
if ref $data xor $self->{'-ref'} |
|
304
|
1 |
2 |
&does($meth_to_call, 'ARRAY') ? : |
|
307
|
0 |
3 |
if (&does($expectation, 'ARRAY')) { } |
|
318
|
2 |
1 |
if $msg |
|
332
|
0 |
0 |
if (&does($expectation, 'ARRAY')) { } |
|
343
|
0 |
0 |
if $msg |
|
368
|
11 |
229 |
if (defined $msgs) |
|
370
|
1 |
10 |
if /^CODE/ |
|
371
|
8 |
2 |
if /^$/ |
|
372
|
2 |
0 |
if $msg = $msgs->{$msg_id} |
|
|
2 |
0 |
if (/^HASH/) |
|
381
|
1 |
228 |
if ref $global_msgs eq "CODE" |
|
383
|
0 |
228 |
unless $msg = $global_msgs->{$subclass}{$msg_id} || $global_msgs->{'Generic'}{$msg_id} |
|
403
|
13 |
114 |
if (my $range = delete $self->{$range_field}) |
|
405
|
0 |
26 |
if defined $self->{$_} |
|
408
|
0 |
13 |
unless &does($range, "ARRAY") and @$range == 2 |
|
419
|
88 |
38 |
if ($cmp_func eq '<=') { } |
|
|
25 |
13 |
elsif ($cmp_func eq 'le') { } |
|
|
13 |
0 |
elsif (&does($cmp_func, 'CODE')) { } |
|
426
|
21 |
105 |
if (defined $min and defined $max) |
|
427
|
5 |
16 |
unless &$cmp_func($min, $max) |
|
438
|
1 |
468 |
unless @{$context->{'path'};} < $MAX_DEEP |
|
442
|
232 |
236 |
if (&does($domain, 'Data::Domain')) { } |
|
|
230 |
6 |
elsif (&does($domain, 'CODE')) { } |
|
|
6 |
0 |
elsif (not ref $domain) { } |
|
455
|
0 |
230 |
unless &does($domain, "Data::Domain") |
|
460
|
3 |
3 |
&Scalar::Util::looks_like_number($domain) ? : |
|
490
|
0 |
123 |
unless &any(sub {
$args_ref->[0] eq $_;
}
, @$options_ref, @common_options) |
|
497
|
24 |
129 |
if (@$args_ref) |
|
498
|
0 |
24 |
unless $default_option |
|
499
|
0 |
24 |
if exists $parsed{$default_option} |
|
501
|
18 |
0 |
$arg_type eq 'arrayref' ? : |
|
|
6 |
18 |
$arg_type eq 'scalar' ? : |
|
544
|
0 |
2 |
if $self->{'-defined'} and $self->{'-optional'} |
|
552
|
9 |
23 |
if (defined $self->{'-defined'}) |
|
554
|
5 |
4 |
if defined $data xor $self->{'-defined'} |
|
604
|
1 |
48 |
if ($self->{'-not_in'}) |
|
606
|
1 |
0 |
if @$vals > 0 |
|
607
|
0 |
1 |
unless &try(sub {
my $vals = $self->{'-not_in'};
not grep({not &looks_like_number($_);} @$vals) if @$vals > 0;
}
) |
|
616
|
107 |
187 |
unless &looks_like_number($data) |
|
619
|
31 |
156 |
if (defined $self->{'-min'}) |
|
621
|
6 |
25 |
unless $data >= $self->{'-min'} |
|
623
|
12 |
169 |
if (defined $self->{'-max'}) |
|
625
|
4 |
8 |
unless $data <= $self->{'-max'} |
|
627
|
5 |
172 |
if (defined $self->{'-not_in'}) |
|
628
|
2 |
3 |
if grep {$data == $_;} @{$$self{"-not_in"};} |
|
647
|
20 |
56 |
unless defined $data and $data =~ /^-?\d+$/ |
|
664
|
1 |
2 |
unless defined $data and $data =~ /^\d+$/ |
|
700
|
3 |
159 |
unless not ref $data or overload::Method($data, "\"\"") |
|
702
|
6 |
153 |
if ($self->{'-min_length'}) |
|
704
|
1 |
5 |
unless length $data >= $self->{'-min_length'} |
|
706
|
5 |
153 |
if (defined $self->{'-max_length'}) |
|
708
|
3 |
2 |
unless length $data <= $self->{'-max_length'} |
|
710
|
132 |
23 |
if ($self->{'-regex'}) |
|
712
|
13 |
119 |
unless $data =~ /$self->{'-regex'}/ |
|
714
|
2 |
140 |
if ($self->{'-antiregex'}) |
|
716
|
1 |
1 |
if $data =~ /$self->{'-antiregex'}/ |
|
718
|
4 |
137 |
if (defined $self->{'-min'}) |
|
720
|
1 |
3 |
unless $data ge $self->{'-min'} |
|
722
|
3 |
137 |
if (defined $self->{'-max'}) |
|
724
|
1 |
2 |
unless $data le $self->{'-max'} |
|
726
|
1 |
138 |
if ($self->{'-not_in'}) |
|
727
|
0 |
1 |
if grep {$data eq $_;} @{$$self{"-not_in"};} |
|
764
|
7 |
35 |
unless (ref $date) |
|
769
|
0 |
7 |
unless $date = {"today", [Today()], "yesterday", [Add_Delta_Days(Today(), -1)], "tomorrow", [Add_Delta_Days(Today(), 1)]}->{$date} |
|
786
|
0 |
1 |
if ref $class |
|
792
|
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} |
|
808
|
6 |
15 |
if ($self->{$bound} and not $self->{$bound} =~ /$dynamic_date/) |
|
809
|
1 |
5 |
unless my(@date) = &$date_parser($self->{$bound}) |
|
819
|
1 |
8 |
if ($self->{'-not_in'}) |
|
823
|
1 |
1 |
if ($date =~ /$dynamic_date/) { } |
|
827
|
0 |
1 |
unless my(@parsed_date) = &$date_parser($date) |
|
833
|
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;
}
) |
|
845
|
4 |
14 |
unless @date and check_date(@date) |
|
848
|
6 |
8 |
if (defined $self->{'-min'}) |
|
851
|
2 |
4 |
if not check_date(@$min) or _date_cmp(\@date, $min) < 0 |
|
854
|
3 |
9 |
if (defined $self->{'-max'}) |
|
857
|
1 |
2 |
if not check_date(@$max) or _date_cmp(\@date, $max) > 0 |
|
860
|
2 |
9 |
if ($self->{'-not_in'}) |
|
861
|
1 |
1 |
if grep {_date_cmp(\@date, $_) == 0;} @{$$self{"-not_in"};} |
|
889
|
0 |
16 |
unless (ref $time) |
|
890
|
0 |
0 |
unless $time eq "now" |
|
907
|
2 |
4 |
unless $_ |
|
921
|
4 |
2 |
if ($self->{$bound} and $self->{$bound} ne "now") |
|
923
|
0 |
4 |
unless @time and _valid_time(@time) |
|
940
|
2 |
4 |
unless @t and _valid_time(@t) |
|
943
|
3 |
1 |
if (defined $self->{'-min'}) |
|
945
|
1 |
2 |
if _time_cmp(\@t, $self->{'-min'}) < 0 |
|
948
|
2 |
1 |
if (defined $self->{'-max'}) |
|
950
|
1 |
1 |
if _time_cmp(\@t, $self->{'-max'}) > 0 |
|
975
|
1 |
2 |
unless &Scalar::Util::openhandle($data) |
|
999
|
0 |
5 |
unless &try(sub {
@{$self->{'-values'};};
}
) |
|
1001
|
1 |
4 |
if grep {not defined $_;} @{$$self{"-values"};} |
|
1012
|
2 |
4 |
unless grep {$_ eq $data;} @{$$self{"-values"};} |
|
1037
|
5 |
7 |
if ($self->{'-items'}) |
|
1038
|
0 |
5 |
unless &does($self->{'-items'}, "ARRAY") |
|
1044
|
0 |
10 |
if $self->{$bound} and $self->{$bound} < @{$self->{'-items'};} |
|
1050
|
8 |
16 |
if (my $dom = $self->{$arg}) |
|
1051
|
7 |
1 |
unless &does($dom, "ARRAY") |
|
1052
|
1 |
8 |
unless &does($_, "Data::Domain") |
|
|
0 |
8 |
unless &all(sub {
&does($_, "CODE") unless &does($_, "Data::Domain");
}
, @$dom) |
|
1065
|
1 |
37 |
unless &does($data, "ARRAY") |
|
1068
|
1 |
36 |
if (defined $self->{'-min_size'} and @$data < $self->{'-min_size'}) |
|
1072
|
1 |
35 |
if (defined $self->{'-max_size'} and @$data > $self->{'-max_size'}) |
|
1076
|
2 |
6 |
unless $self->{'-items'} or $self->{'-all'} or $self->{'-any'} |
|
1094
|
0 |
50 |
unless my $subdomain = $self->_build_subdomain($items->[$i], $context) |
|
1101
|
8 |
25 |
if (my $all = $self->{'-all'}) |
|
1102
|
8 |
0 |
unless &does($all, "ARRAY") |
|
1115
|
9 |
24 |
if $has_invalid |
|
1118
|
13 |
11 |
if (my $any = $self->{'-any'}) |
|
1119
|
9 |
4 |
unless &does($any, "ARRAY") |
|
1123
|
1 |
12 |
unless $n_data > $n_items |
|
1133
|
11 |
20 |
unless $error |
|
1159
|
13 |
1 |
if (&does($fields, 'ARRAY')) { } |
|
|
1 |
0 |
elsif (&does($fields, 'HASH')) { } |
|
1178
|
3 |
11 |
if (my $exclude = $self->{'-exclude'}) |
|
1179
|
0 |
2 |
unless &does($exclude, "ARRAY") or &does($exclude, "Regexp") or not ref $exclude |
|
1186
|
2 |
26 |
if (my $dom = $self->{$arg}) |
|
1187
|
0 |
2 |
unless &does($dom, "Data::Domain::List") or &does($dom, "CODE") |
|
1201
|
2 |
135 |
unless &does($data, "HASH") |
|
1205
|
9 |
126 |
if (my $exclude = $self->{'-exclude'}) |
|
1208
|
5 |
8 |
if $self->{'-fields'}{$field} |
|
1210
|
6 |
2 |
if match::simple::match($field, $exclude) or match::simple::match($exclude, ["*", "all"]) |
|
1232
|
13 |
241 |
if $msg |
|
1237
|
3 |
26 |
if (my $keys_dom = $self->{'-keys'}) |
|
1240
|
1 |
2 |
if $msgs{'-keys'} = $subdomain->inspect([keys %$data], $context) |
|
1245
|
3 |
26 |
if (my $values_dom = $self->{'-values'}) |
|
1248
|
1 |
2 |
if $msgs{'-values'} = $subdomain->inspect([values %$data], $context) |
|
1252
|
10 |
19 |
$has_invalid ? : |
|
1269
|
0 |
2 |
unless &Scalar::Does::does($self->{'-options'}, "ARRAY") |
|
1282
|
109 |
112 |
unless my $msg = $subdomain->inspect($data, $context) |
|
1304
|
0 |
1 |
unless &Scalar::Does::does($self->{'-options'}, "ARRAY") |
|
1318
|
2 |
4 |
if $msg |
|
1320
|
2 |
1 |
@msgs ? : |