Branch Coverage

blib/lib/Newtype.pm
Criterion Covered Total %
branch 53 74 71.6


line true false branch
30 1 4 $INC{'Type/Registry.pm'} ? :
5 0 unless ref $caller or $caller eq "-lexical" or $globals->{'lexical'}
38 2 12 if (is_Object($class))
43 6 6 @_ == 1 && is_HashRef($_[0]) ? :
45 1 11 if (is_Undef($opts{'inner'})) { }
2 9 elsif (is_Str($opts{'inner'})) { }
68 1 9 if $inner_type->is_a_type_of(&ArrayRef())
69 0 9 if $inner_type->is_a_type_of(&Bool())
70 0 9 if $inner_type->is_a_type_of(&CodeRef())
71 2 7 if $inner_type->is_a_type_of(&Int())
72 4 3 if $inner_type->is_a_type_of(&HashRef())
73 1 2 if $inner_type->is_a_type_of(&StrictNum()) or $inner_type->is_a_type_of(&LaxNum())
75 2 0 if $inner_type->is_a_type_of(&Object())
76 0 0 if $inner_type->is_a_type_of(&Str())
86 5 15 if ($e->{'tags'}[0] eq "types")
88 5 7 unless my($inner_value, @rest) = @_
92 4 3 wantarray ? :
163 2 9 unless my $overloading = {"Array", "( q[\@{}] => sub { \${+shift} }, bool => sub { !!1 }, fallback => 1 )", "Bool", "( bool => sub { !!\${+shift} }, fallback => 1 )", "Code", "( q[&{}] => sub { \${+shift} }, bool => sub { !!1 }, fallback => 1 )", "Counter", "( q[0+] => sub { \${+shift} }, bool => sub { \${+shift} }, fallback => 1 )", "Hash", "( q[%{}] => sub { \${+shift} }, bool => sub { !!1 }, fallback => 1 )", "Number", "( q[0+] => sub { \${+shift} }, bool => sub { \${+shift} }, fallback => 1 )", "String", "( q[\"\"] => sub { \${+shift} }, bool => sub { \${+shift} }, fallback => 1 )"}->{$self->kind}
166 0 9 unless eval "package $class; use overload $overloading; 1"
179 2 9 if ($kind eq 'Object' and is_Defined($known_class)) { }
0 9 elsif ($kind eq 'Object') { }
194 0 2 unless eval "\n\t\tpackage " . $class . ";\n\t\tsub AUTOLOAD {\n\t\t\tmy \$self = shift;\n\t\t\tmy ( \$method ) = ( our \$AUTOLOAD =~ /::(\\w+)\$/ );\n\t\t\tif ( ref(\$self) ) {\n\t\t\t\tif ( \$method eq 'DESTROY' ) {\n\t\t\t\t\tmy \$found = \$\$self->can( 'DESTROY' ) or return;\n\t\t\t\t\treturn \$\$self->\$found( \@_ );\n\t\t\t\t}\n\t\t\t\treturn \$\$self->\$method( \@_ );\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn \"" . $parent_class . "\"->\$method( \@_ );\n\t\t\t}\n\t\t}\n\t\tsub isa {\n\t\t\tmy ( \$self, \$c ) = \@_;\n\t\t\t\$c = \$c->class if Scalar::Util::blessed(\$c) && \$c->can('class');\n\t\t\tref(\$self) && \$\$self->isa( \$c ) or\n\t\t\t\t\"" . $parent_class . "\"->isa( \$c ) or\n\t\t\t\t\$self->UNIVERSAL::isa( \$c );\n\t\t}\n\t\tsub DOES {\n\t\t\tmy ( \$self, \$r ) = \@_;\n\t\t\t\$r = \$r->class if Scalar::Util::blessed(\$r) && \$r->can('class');\n\t\t\t\$r eq 'Newtype' or\n\t\t\t\t\$r eq 'Object' or\n\t\t\t\tref(\$self) && \$\$self->DOES( \$r ) or\n\t\t\t\t\"" . $parent_class . "\"->DOES( \$r ) or\n\t\t\t\t\$self->UNIVERSAL::DOES( \$r );\n\t\t}\n\t\tsub can {\n\t\t\tmy ( \$self, \$m ) = \@_;\n\t\t\tref(\$self) && \$\$self->can( \$m ) or\n\t\t\t\t\"" . $parent_class . "\"->can( \$m ) or\n\t\t\t\t\$self->UNIVERSAL::can( \$m );\n\t\t}\n\t\t1;\n\t"
6 0 unless my $found = $$self->can("DESTROY")
6 3 if ($method eq "DESTROY")
9 0 if (ref $self) { }
0 1 if &Scalar::Util::blessed($r) and $r->can("class")
0 1 unless $r eq "Newtype" or $r eq "Object" or ref $self and $$self->DOES($r) or "Local::Foo"->DOES($r)
0 0 unless ref $self and $$self->can($m) or "Local::Foo"->can($m)
0 8 if &Scalar::Util::blessed($c) and $c->can("class")
6 2 unless ref $self and $$self->isa($c) or "Local::Foo"->isa($c)
242 0 0 unless eval "\n\t\tpackage " . $class . ";\n\t\tsub AUTOLOAD {\n\t\t\tmy \$self = shift;\n\t\t\tref(\$self) or return;\n\t\t\tmy ( \$method ) = ( our \$AUTOLOAD =~ /::(\\w+)\$/ );\n\t\t\tif ( \$method eq 'DESTROY' ) {\n\t\t\t\tmy \$found = \$\$self->can( 'DESTROY' ) or return;\n\t\t\t\treturn \$\$self->\$found( \@_ );\n\t\t\t}\n\t\t\t\$\$self->\$method( \@_ );\n\t\t}\n\t\tsub isa {\n\t\t\tmy ( \$self, \$c ) = \@_;\n\t\t\t\$c = \$c->class if Scalar::Util::blessed(\$c) && \$c->can('class');\n\t\t\tref(\$self) && \$\$self->isa( \$c ) or\n\t\t\t\t\$self->UNIVERSAL::isa( \$c );\n\t\t}\n\t\tsub DOES {\n\t\t\tmy ( \$self, \$r ) = \@_;\n\t\t\t\$r = \$r->class if Scalar::Util::blessed(\$r) && \$r->can('class');\n\t\t\t\$r eq 'Newtype' or\n\t\t\t\t\$r eq 'Object' or\n\t\t\t\tref(\$self) && \$\$self->DOES( \$r ) or\n\t\t\t\t\$self->UNIVERSAL::DOES( \$r );\n\t\t}\n\t\tsub can {\n\t\t\tmy ( \$self, \$m ) = \@_;\n\t\t\tref(\$self) && \$\$self->can( \$m ) or\n\t\t\t\t\$self->UNIVERSAL::can( \$m );\n\t\t}\n\t\t1;\n\t"
283 0 9 unless eval "\n\t\tpackage " . $class . ";\n\t\tsub DOES {\n\t\t\tmy ( \$self, \$r ) = \@_;\n\t\t\t\$r = \$r->class if Scalar::Util::blessed(\$r) && \$r->can('class');\n\t\t\t\$r eq 'Newtype' or\n\t\t\t\t\$r eq '" . $kind . "' or\n\t\t\t\t\$self->UNIVERSAL::DOES( \$r );\n\t\t}\n\t\t1;\n\t"
302 2 9 if $kind eq "Object"
324 0 9 unless eval "require $shv_lib; 1"
328 1 206 if $already{$h_name}++
376 1 10 if ($inner_type->has_coercion)
381 0 1 unless $inner_type->check($coerced_inner_value)