Branch Coverage

blib/lib/JSONSchema/Validator/Util.pm
Criterion Covered Total %
branch 47 92 51.0


line true false branch
46 0 6 if (eval { do { require YAML::XS; 'YAML::XS'->VERSION(0.67); 1 } }) { }
0 6 elsif (eval { do { require YAML::PP; 1 } }) { }
58 6 0 if (eval { do { require Cpanel::JSON::XS; 1 } }) { }
0 0 elsif (eval { do { require JSON::XS; 'JSON::XS'->VERSION(3); 1 } }) { }
71 0 6 if (eval { do { require LWP::UserAgent; 1 } }) { }
0 6 elsif (eval { do { require Mojo::UserAgent; 1 } }) { }
76 0 0 if ($response->is_success)
86 0 0 if ($response->is_success)
98 8 0 if ref $x eq "JSON::PP::Boolean"
99 0 0 if ref $x
100 0 0 if $x and $x eq 1
101 0 0 if not defined $x or $x eq 0 or $x eq ""
109 0 0 $value >= 0 ? :
119 62 0 unless exists $scheme_handlers->{$s}
125 31 0 if ($scheme) { }
126 0 31 if (exists $scheme_handlers->{$scheme}) { }
31 0 elsif ($scheme eq 'file') { }
144 77 0 if ($mime_type)
145 0 77 if ($mime_type =~ /yaml/) { }
77 0 elsif ($mime_type =~ /json/) { }
147 0 0 if $@
151 0 77 if $@
154 0 77 unless ($schema)
157 0 0 if $@
158 0 0 unless $schema
166 0 77 unless -e $path
167 0 77 unless -r _
171 0 77 unless $suffix
175 0 77 unless open my $fh, "<", $path
184 0 7711 unless exists {"_ref" => sub { package JSONSchema::Validator::Util; use warnings; use strict; my $ref = ref $_[0]; return 0 unless $ref; return 0 if $ref eq "JSON::PP::Boolean" or $ref eq "HASH" or $ref eq "ARRAY"; return 1;},"array" => sub { package JSONSchema::Validator::Util; use warnings; use strict; return ref $_[0] eq "ARRAY";},"boolean" => sub { package JSONSchema::Validator::Util; use warnings; use strict; my $type = ref $_[0]; return 1 if $type eq "JSON::PP::Boolean" or $type eq "JSON::XS::Boolean" or $type eq "Cpanel::JSON::XS::Boolean"; return 0 if $_[1]; my $is_number = looks_like_number($_[0]) && ($_[0] == 1 || $_[0] == 0); my $is_string = defined $_[0] && $_[0] eq ""; my $is_undef = !defined($_[0]); return 1 if $is_number or $is_string or $is_undef; return 0;},"integer" => sub { package JSONSchema::Validator::Util; use warnings; use strict; return 1 if B::svref_2object(\$_[0])->FLAGS & 256; return 0 if $_[1]; return 0 if ref $_[0]; return 1 if looks_like_number($_[0]) and int $_[0] == $_[0]; return 0;},"null" => sub { package JSONSchema::Validator::Util; use warnings; use strict; return !defined($_[0]);},"number" => sub { package JSONSchema::Validator::Util; use warnings; use strict; return 1 if B::svref_2object(\$_[0])->FLAGS & 768; return 0 if $_[1]; return 0 if ref $_[0]; return 1 if looks_like_number($_[0]); return 0;},"object" => sub { package JSONSchema::Validator::Util; use warnings; use strict; return ref $_[0] eq "HASH";},"string" => sub { package JSONSchema::Validator::Util; use warnings; use strict; return !(ref $_[0] || is_number(@_)) && defined $_[0] if $_[1]; return !ref($_[0]) && defined $_[0];}}->{$_[1]}
191 45 276 if {"_ref" => sub { ;},"array" => sub { ;},"boolean" => sub { ;},"integer" => sub { ;},"null" => sub { ;},"number" => sub { ;},"object" => sub { ;},"string" => sub { ;}}->{$type}->(@_)
205 0 2900 if $type eq "JSON::PP::Boolean" or $type eq "JSON::XS::Boolean" or $type eq "Cpanel::JSON::XS::Boolean"
208 2893 7 if $_[1]
212 2 5 if $is_number or $is_string or $is_undef
218 110 110 if B::svref_2object(\$_[0])->FLAGS & 256
219 68 42 if $_[1]
220 8 34 if ref $_[0]
221 20 14 if looks_like_number($_[0]) and int $_[0] == $_[0]
227 107 967 if B::svref_2object(\$_[0])->FLAGS & 768
228 958 9 if $_[1]
229 4 5 if ref $_[0]
230 1 4 if looks_like_number($_[0])
237 30 10 unless $ref
238 0 0 if $ref eq "JSON::PP::Boolean" or $ref eq "HASH" or $ref eq "ARRAY"
256 310 157 if $_[1]
263 0 0 unless fileno $handle