Branch Coverage

lib/HTTP/Promise/Headers.pm
Criterion Covered Total %
branch 196 496 39.5


line true false branch
32 0 14 if (exists $ENV{'MOD_PERL'} and $HTTP::Promise::Headers::MOD_PERL = $ENV{'MOD_PERL'} =~ m[^mod_perl/(\d+\.[\d\.]+)])
101 20 168 if ref $_[-1] eq "HASH"
109 0 188 if ($@)
116 20 168 if exists $opts->{'debug'}
125 0 0 if (@_)
158 0 0 if $self->{'acceptables'}
160 0 0 if ($accept_raw)
196 0 0 if (@_) { }
209 0 0 unless $all->length
235 8 92 if (defined $type and lc [split(m[/], $type, 2)]->[0] eq "multipart")
238 2 6 unless ($boundary)
246 61 39 @_ ? :
247 1 99 if (index($str, "\r\r\n") != -1)
263 0 7 if (@_)
270 0 0 unless length $ct
278 4 3 unless (length $self->{'boundary'} and $self->{'_ctype_cached'} eq $self->content_type)
281 4 0 defined $ct ? :
295 0 0 if (@_)
302 0 0 unless length $ct
307 0 0 unless (length $self->{'charset'})
339 0 2 unless defined $type and length "$type"
348 0 0 unless defined $type and length "$type"
357 2 14 unless defined $type and length "$type"
366 0 3 unless defined $type and length "$type"
376 4 24 unless defined $type and length "$type"
378 0 24 if $type eq "text/xml"
379 3 21 if $type eq "application/xml"
380 1 20 if $type =~ /\+xml$/
407 16 387 if (@_) { }
412 8 8 if (index($v, ';') == -1) { }
422 2 14 ref $v ? :
429 241 146 if (defined $v) { }
0 146 elsif (want('OBJECT')) { }
431 9 232 ref $v ? :
464 0 11 unless defined $fname and length $fname
466 1 10 if ($fname =~ /^(.*?)\'([^\']*)\'(.*?)$/) { }
4 6 elsif ($fname =~ /^=\?(.+?)\?(.+?)\?(.+)\?=$/) { }
469 0 1 unless (lc $charset eq "utf8" or lc $charset eq "utf-8")
483 3 1 if ($encoding eq "Q" or $encoding eq "B")
487 1 2 if ($encoding eq 'Q') { }
490 0 1 unless $self->_load_class("HTTP::Promise::Stream")
494 0 1 unless defined $decoded
500 0 2 unless $self->_load_class("Crypt::Misc")
505 0 3 if ($@)
513 0 3 unless $self->_load_class("Encode")
514 0 3 unless $self->_load_class("Encode::Locale")
519 1 2 if ($@)
526 10 1 wantarray ? :
534 114 0 if (@_)
538 0 114 if ($self->{'debug'} and not $self->{'debug_level'})
569 3 0 if ($fname =~ /[^\w\.]+/)
571 3 0 unless defined $lang
587 1 1 if (@_)
592 0 1 if (&Scalar::Util::blessed($_[0]) and $_[0]->isa('Module::Generic::Exception') or &Scalar::Util::blessed($_[0])) { }
0 1 elsif (ref $_[0] eq 'HASH') { }
603 0 1 ref $_ eq 'CODE' && !$self->{'_msg_no_exec_sub'} ? :
608 0 1 exists $self->{'error_max_length'} && $self->{'error_max_length'} =~ /^[-+]?\d+$/ ? :
609 0 1 if $max_len > 0 and length $args->{'message'} > $max_len
614 0 1 if defined &{"CORE::GLOBAL::caller";}
615 0 1 if (defined $o) { }
625 1 0 exists $self->{'_exception_class'} && length $self->{'_exception_class'} ? :
0 1 length $args->{'class'} ? :
626 0 0 unless ($self->_is_class_loaded($ex_class) or scalar keys %{"${ex_class}::";})
632 0 0 if $@
638 0 1 if ($MOD_PERL)
645 0 0 if $r
647 0 0 if ($@)
653 0 1 if ($r) { }
0 1 elsif ($self->{'fatal'} or defined ${"${class}::FATAL_ERROR";} and ${"${class}::FATAL_ERROR";}) { }
1 0 elsif (warnings::enabled()) { }
655 0 0 if (my $log_handler = $r->get_handlers('PerlPrivateErrorHandler')) { }
661 0 0 if warnings::enabled()
672 0 1 if ($r) { }
680 0 1 $@ ? :
694 0 1 if (not $args->{'no_return_null_object'} and want("OBJECT"))
704 0 1 if (not $self->{'error'} and want("OBJECT"))
710 1 0 ref $self ? :
720 0 66 defined $rv ? :
788 0 2 unless $self->_load_class("Data::UUID")
800 0 0 if ($self->{'verbose'} or $self->{'debug'} or ${$class . "::DEBUG";})
803 0 0 if ($HTTP::Promise::Headers::MOD_PERL)
811 0 0 if ($@)
819 0 0 unless $ref
822 0 0 if ref $ref->[-1] eq "HASH"
825 0 0 unless $stackFrame =~ /^\d+$/
826 0 0 if $stackFrame
827 0 0 if ((caller 1)[3] // "") eq "HTTP::Promise::Headers::messagef"
831 0 0 if (ref $self->{'_message_frame'} eq "HASH")
833 0 0 if (exists $self->{'_message_frame'}{$sub2})
836 0 0 if ($frameNo > 0)
843 0 0 if ($sub2 eq "message")
851 0 0 if ($opts->{'message'}) { }
853 0 0 if (ref $opts->{'message'} eq 'ARRAY') { }
855 0 0 ref $_ eq 'CODE' && !$self->{'_msg_no_exec_sub'} ? :
864 0 0 ref $_ eq 'CODE' && !$self->{'_msg_no_exec_sub'} ? :
868 0 0 length $opts->{'prefix'} ? :
870 0 0 unless exists $opts->{'caller_info'} and length $opts->{'caller_info'}
877 0 0 $opts->{'caller_info'} ? :
889 0 0 exists $opts->{'level'} ? :
0 0 $_[0] =~ /^\d+$/ ? :
891 0 0 if $opts->{'type'}
894 0 0 if ($r and not ${"${class}::LOG_DEBUG";}) { }
0 0 elsif ($HTTP::Promise::Headers::MOD_PERL and not ${"${class}::LOG_DEBUG";}) { }
0 0 elsif (not -t STDIN and $self->{'_log_handler'} and ref $self->{'_log_handler'} eq 'CODE') { }
0 0 elsif (not -t STDIN and ${$class . '::MESSAGE_HANDLER';} and ref ${$class . '::MESSAGE_HANDLER';} eq 'CODE') { }
896 0 0 if (my $log_handler = $r->get_handlers('PerlPrivateLogHandler')) { }
0 0 elsif ($self->{'_log_handler'} and ref $self->{'_log_handler'} eq 'CODE') { }
929 0 0 if ($opts->{'no_encoding'}) { }
948 0 0 if (@_)
950 0 0 unless ($_[0] =~ /^\d/)
953 0 0 if (ref $_[-1] eq 'HASH' and exists $_[-1]{'level'}) { }
0 0 elsif ($self->{'_message_default_level'} =~ /^\d+$/ and $self->{'_message_default_level'} > 0) { }
970 0 0 if ($_[0] =~ /^\d+$/ || ref $_[-1] eq 'HASH' && exists $_[-1]{'level'} && $_[-1]{'level'} =~ /^\d+$/ and @_ > 1)
978 0 0 if ($_[0] =~ /^\d+$/) { }
0 0 elsif (ref $_[-1] eq 'HASH' and exists $_[-1]{'level'}) { }
987 0 0 if (ref ${"${class}::DEBUG_TARGET";} eq "ARRAY")
989 0 0 scalar @${"${class}::DEBUG_TARGET";} ? :
991 0 0 if (int $self->{'debug'} >= $message_level or int $self->{'verbose'} >= $message_level or defined ${$class . '::DEBUG';} and ${$class . '::DEBUG';} >= $message_level or int $self->{'debug_level'} >= $message_level or int $self->{'debug'} >= 100 or length $target_re and $class =~ /^$target_re$/ and ${$class . '::GLOBAL_DEBUG';} >= $message_level) { }
1012 0 0 unless exists $self->{'_message_frame'}
1014 0 0 if (@_)
1017 0 0 if (ref $_[0] eq 'HASH') { }
0 0 elsif (not @_ % 2) { }
0 0 elsif (scalar @_ == 1) { }
1032 0 0 if index($sub, "::") != -1
1050 0 10 unless defined $attr and length $attr
1056 10 0 if (defined $v and length $v)
1059 0 10 unless defined $hv
1061 0 10 if (scalar @_ > 1) { }
1063 0 0 if (defined $subtag) { }
1065 0 0 unless defined $hv
1070 0 0 if (defined $hv) { }
1085 0 10 unless defined $hv
1086 8 2 defined $subtag ? :
1097 2 0 unless defined $te and length $te
1109 52 63 unless (defined $ct and length $ct)
1111 3 49 if defined $default
1121 0 17 unless defined $ct and length "$ct"
1123 2 15 if index($ct, ";") == -1 or index($ct, "boundary") == -1
1145 0 94 unless defined $field and length "$field"
1146 0 94 unless (scalar keys %$SUPPORTED)
1148 0 0 unless $self->_load_class("Module::Generic::File")
1150 0 0 unless $dir->open
1154 0 0 if $f->extension ne "pm"
1161 0 94 unless exists $HTTP::Promise::Headers::SUPPORTED->{$name}
1163 0 94 unless $self->_load_class($class)
1195 0 0 if (scalar @_)
1199 0 0 if (scalar @_ == 1 and ref $_[0] eq 'HASH') { }
1206 0 0 if (scalar @_ > 1 and ref $_[-1] eq "HASH")
1214 0 0 if scalar keys %$opts == 1 and [keys %$opts]->[0] eq "class"
1219 0 0 if (not defined $err and !scalar(@_) || defined $class) { }
0 0 elsif (defined $err and &Scalar::Util::blessed($err) and scalar @_ == 1 || scalar @_ == 2 && defined $class) { }
1221 0 0 if (not defined $self->{'error'}) { }
1227 0 0 defined $class ? :
1236 0 0 defined $class ? :
1244 0 0 if (want("OBJECT"))
1251 0 0 if ($self->debug)
1265 0 59 unless $self->_is_glob($fh) or $self->_is_a($fh, "HTTP::Promise::IO")
1292 1 0 if (defined $value and $value ne "" and $value =~ /\S/)
1378 0 280 if (@_) { }
97 183 elsif (length $self->{'type'} and $self->{'_ctype_cached'} eq $self->content_type) { }
1387 0 0 if $ct->boundary
1397 132 51 unless defined $ctype_raw and length "$ctype_raw"
1400 30 21 if (index($ctype_raw, ';') == -1) { }
1409 0 21 unless defined $ct
1413 6 15 if defined $charset
1415 9 12 if $ct->boundary
1476 0 9 unless defined $field and length $field
1477 0 9 unless $self->_load_class("Crypt::Misc")
1478 4 5 if (@_) { }
1481 1 3 if index($user, ":") != -1
1482 1 2 unless defined $pwd
1489 1 0 unless defined $v or want("OBJECT")
1490 4 0 if (defined $v and $v =~ /^[[:blank:]\h]*Basic[[:blank:]\h]+(.+?)$/)
1494 3 1 wantarray ? :
1502 0 141 unless defined $f and length "$f"
1503 15 126 if (@_) { }
1506 0 15 unless defined $this
1508 15 0 unless defined $opts->{'time_zone'} and length $opts->{'time_zone'}
1511 15 0 if ($this =~ /^\d+$/) { }
0 0 elsif (&Scalar::Util::blessed($this) and $this->isa('DateTime')) { }
0 0 elsif (&Scalar::Util::blessed($this) and $this->isa('Module::Generic::DateTime')) { }
1519 0 15 if ($@)
1550 0 15 if ($@)
1559 62 64 unless defined $v and length "$v"
1560 0 64 if (not length "$v" or ref $v and not overload::Method($v, "\"\""))
1562 0 0 if length "$v"
1575 1 63 unless (&Scalar::Util::blessed($v) and $v->isa("Module::Generic::DateTime"))
1579 1 0 if (index($v, ";") != -1)
1585 0 1 unless defined $dt
1591 0 64 if ($@)
1602 0 0 unless scalar @_
1604 0 0 if (scalar @_ == 1 and defined $_[0] and ref $_[0] and &Scalar::Util::reftype($_[0]) eq 'ARRAY') { }
1623 15 59 unless scalar @_
1627 0 59 Want::want('LIST') ? :
1628 59 0 if (scalar @_ == 1 and &Scalar::Util::reftype($_[0]) eq 'HASH') { }
0 0 elsif (not scalar(@_) % 2) { }
1631 0 59 if $need_list
1636 0 0 if ($need_list)
1644 0 59 $need_list ? :
1651 0 0 unless defined $f and length "$f"
1653 0 0 if (wantarray) { }
1656 0 0 unless @values
1668 0 0 if @_ % 2
1673 0 0 unless defined $v
1674 0 0 if ($self->_is_array($v)) { }
1676 0 0 $self->_is_object($v) ? :
1691 0 0 if ($@)
1704 0 59 unless $obj and $pkg
1705 0 59 unless &Scalar::Util::blessed($obj)
1720 0 59 if scalar(@_ < 2)
1721 0 59 unless defined $_[1]
1723 0 59 unless defined $type
1732 0 114 if $@
1740 0 104 if @_
1749 0 3 unless defined $f and length "$f"
1750 1 2 if (@_) { }
1753 0 1 unless defined $v
1766 0 2 if (@vals > 1) { }
1 1 elsif (not defined $vals[0]) { }
1772 0 1 if (want('OBJECT')) { }
1789 0 1 wantarray ? :
1798 0 207 unless defined $f and length "$f"
1799 21 186 if (@_) { }
1802 0 21 unless defined $v
1809 0 186 if (@vals > 1) { }
99 87 elsif (not defined $vals[0]) { }
1816 30 69 if (want('OBJECT')) { }
1837 0 24 unless defined $f and length "$f"
1838 1 23 if (@_) { }
1841 0 1 unless defined $v
1848 22 1 unless (defined $v and length $v)
1850 0 22 if (want('OBJECT')) { }
1863 1 0 if ($v =~ /^[[:blank:]\h]*(\d{1,16})[[:blank:]\h]*$/) { }
1871 0 1 if ref $v and not overload::Method($v, "\"\"")
1880 0 9 unless defined $f and length "$f"
1881 3 6 if (@_) { }
1884 0 3 unless defined $v
1899 0 6 if ($@)
1919 0 10 if (exists $h->{$f}) { }
1921 0 0 unless ref $h->{$f} eq "ARRAY"
1937 0 5 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
1963 4 0 exists $obj->{'_deserialisation_params'} && ref $obj->{'_deserialisation_params'} eq 'HASH' ? :
1967 4 0 ref $hash->{'_headers_to_restore'} eq 'ARRAY' ? :
1983 0 0 scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
1984 0 0 defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
1985 0 0 ref $ref eq 'ARRAY' ? :
1988 0 0 exists $hash->{'_headers_to_restore'} && ref $hash->{'_headers_to_restore'} eq 'ARRAY' ? :
1993 0 0 if scalar grep($_, @$headers)