Branch Coverage

blib/lib/MooX/Press.pm
Criterion Covered Total %
branch 491 712 68.9


line true false branch
21 0 311 $] lt '5.018' ? :
84 42 7 unless exists $opts->{'version'}
87 42 7 unless exists $opts->{'authority'}
89 10 39 unless (exists $opts->{'prefix'})
91 2 8 if ($opts->{'prefix'} eq "main")
99 24 0 defined $opts->{'prefix'} ? :
24 25 unless exists $opts->{'factory_package'}
101 0 24 if (not $no_warn and defined $opts->{'factory_package'} and $opts->{'factory_package'} eq "Local")
103 0 0 if ($FindBin::Script ne "-e")
109 49 0 unless (exists $opts->{'type_library'})
117 0 49 @_ == 1 ? :
133 2 0 if (is_CodeRef($pkg->[1]) or is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{'code'}))
141 2 0 if (is_CodeRef($pkg->[1]) or is_HashRef($pkg->[1]) and is_CodeRef($pkg->[1]{'code'}))
153 0 57 exists $pkg->[1]{'prefix'} ? :
158 9 60 if (defined $pkg->[1]{'extends'} and not ref $pkg->[1]{'extends'})
164 49 0 if ($opts{'type_library'})
179 47 2 if ($opts{'factory_package'})
188 47 2 if (defined $opts{'factory_package'})
195 47 0 if (my $p = $opts{'prefix'})
197 45 2 unless exists &{$opts{'factory_package'} . "::qualify";}
199 45 2 unless exists &{$opts{'factory_package'} . "::get_class";}
201 45 2 unless exists &{$opts{'factory_package'} . "::get_role";}
203 45 2 if keys %methods
206 0 47 if keys %methods
236 2 47 if (keys %modifiers)
246 2 302 unless defined $pkg
248 291 11 if (defined $opts->{'factory_package'})
259 55 493 if ($key =~ /^(class|role|class_generator|role_generator):((?:::)?[^:].*)$/)
262 53 2 if (ref $val) { }
2 0 elsif ($val eq 1 or not defined $val) { }
304 0 909 if ($name =~ /^[\@%\$]/)
308 6 903 if defined $parent and $name =~ /^\+(.+)/
309 290 619 if $name =~ /^(main)?::(.+)$/
310 617 2 $prefix ? :
317 12 390 unless defined $prefix
319 380 22 if (length $prefix and lc substr($name, 0, length $prefix) eq lc $prefix)
334 1 4 ref $_[0] ? :
348 1 1 unless @roles
362 0 1 $class->can('with_traits') ? :
373 1 0 if @roles == 1
401 2 47 if exists &{"${lib}::_mooxpress_add_type";}
412 1 190 if $types_hash{$kind}{$target}
423 186 4 if defined $opts{'factory_package'}
424 7 183 if ($coercions)
432 6 218 if ($target =~ /^([\@%])(.+)$/)
435 6 0 if ($sigil eq '@') { }
0 0 elsif ($sigil eq '%') { }
437 6 0 if $types_hash{$kind}{$target}
441 0 0 if $types_hash{$kind}{$target}
446 45 2 if (defined $opts{'factory_package'} or not exists $opts{'factory_package'})
455 0 45 unless eval sprintf("\n\t\t\t\tpackage %s;\n\t\t\t\tsub type_library { %s };\n\t\t\t\tsub get_type_for_package { shift->type_library->get_type_for_package(\@_) };\n\t\t\t\t1;\n\t\t\t", $opts{'factory_package'}, B::perlstring($lib))
461 7 40 if defined $version
462 7 40 if defined $authority
468 0 59 unless $opts{'type_library'}
469 0 59 if $opts{'extends'}
476 0 132 unless $opts{'type_library'}
485 2 0 if ($opts{'type_library'})
502 2 0 if ($opts{'factory_package'})
516 191 0 if ($opts{'type_library'}->can("_mooxpress_add_type"))
522 59 132 $opts{'is_role'} ? :
525 75 116 if (defined $opts{'with'})
535 15 176 if (defined $opts{'subclass'} and not $opts{'is_role'})
564 189 0 if ($opts{'type_library'})
565 57 132 $opts{'is_role'} ? :
568 7 182 if ($opts{'coerce'})
569 0 7 if ($opts{'abstract'})
574 0 7 unless $opts{'coerce'}
578 3 4 unless (ref $type)
580 3 0 if $tc
583 0 7 unless defined $method_name and not ref $method_name
587 7 0 if is_CodeRef($coercions[0])
589 7 0 if ($coderef)
596 7 0 if ($mytype)
603 15 174 if (defined $opts{'subclass'} and not $opts{'is_role'})
618 0 71 if ($opts{'interface'})
620 0 0 if ($opts{$key})
629 0 426 if ($opts{$key})
632 0 0 $opts{'interface'} ? :
644 1 139 if ($opts{'abstract'})
646 0 1 if ($opts{$key})
648 0 0 $opts{'extends'} ? :
656 0 560 if ($opts{$key})
658 0 0 $opts{'extends'} ? :
660 0 0 $opts{'abstract'} ? :
686 2 82 if (@raw > 1 and ref $raw[1]) { }
696 2 82 if $changed
705 81 130 $opts{'extends'} ? :
711 7 204 if ${"${qname}::BUILT";}
713 65 139 $opts{'is_role'} ? :
715 186 4 unless (exists $opts{'factory'} or exists $opts{'multifactory'})
716 1 185 $opts{'abstract'} ? :
725 65 139 if ($opts{'is_role'}) { }
731 88 51 if $toolkit eq "Moo" and eval {
732 0 139 if $toolkit eq "Moose" and eval {
736 81 58 if (@isa)
742 80 1 if ${"${parent_qname}::BUILT";}
743 0 1 if eval {
749 0 1 unless $opts{'_classes'}
0 1 unless my(@dfns) = @{[] unless $opts{'_classes'};}
756 2 1 $dfn_spec{'extends'} ? :
760 1 2 if ($parent_qname eq $dfn_qname)
775 195 9 if ($opts{'factory_package'})
794 140 268 if (defined $opts{lc $var})
799 195 9 if ($opts{'factory_package'})
800 0 195 unless eval "sub ${qname}::FACTORY { q[" . $opts{'factory_package'} . "] }; 1"
805 51 153 if (defined $opts{'import'})
810 0 0 if (is_HashRef($imports[0])) { }
0 0 elsif (is_ArrayRef($imports[0])) { }
820 1 203 if (my $hook = $opts{'begin'})
822 0 1 is_HashRef($_) ? :
1 0 is_ArrayRef($hook) ? :
825 0 1 $opts{'is_role'} ? :
829 1 203 if ($opts{'overload'})
836 30 174 if (defined $opts{'can'})
838 30 0 if keys %methods
841 0 204 if (defined $opts{'factory_package_can'} and defined $opts{'factory_package'})
843 0 0 if keys %methods
846 0 204 if (defined $opts{'type_library_can'} and defined $opts{'type_library'})
848 0 0 if keys %methods
851 5 199 if (defined $opts{'constant'})
853 5 0 if keys %constants
856 36 168 if (defined $opts{'has'})
860 10 194 if (defined $opts{'symmethod'})
864 4 200 if (defined $opts{'multimethod'})
868 2 2 $opts{'is_role'} ? :
872 76 128 if (defined $opts{'with'})
874 76 0 if (@roles)
877 1 102 if (@roles > 1 and ref $roles[1]) { }
887 6 94 unless ($role_qname =~ /\?$/ or ${"${role_qname}::BUILT";})
894 6 0 if $role_dfn
901 10 66 $opts{'is_role'} ? :
905 1 203 if ($opts{'is_role'} and defined $opts{'requires'})
908 1 0 if keys %requires
911 195 9 if (defined $opts{'factory_package'})
913 182 13 if ($opts{'factory'})
914 0 182 if ($opts{'abstract'} and $opts{'factory'}->$_handle_list)
920 4 191 if ($opts{'multifactory'})
924 0 4 unless my $old_coderef = $method_spec->{'code'}
932 20 592 if (defined $opts{$modifier})
945 65 139 if ($opts{'is_role'}) { }
947 9 121 if (my $hook = $opts{$event})
950 0 9 is_HashRef($_) ? :
5 4 is_ArrayRef($hook) ? :
959 26 113 if ($toolkit eq "Moose" and not $opts{'mutable'})
961 14 12 unless $opts{'definition_context'}
966 0 139 if ($toolkit eq "Moo" and eval {
970 1 138 if ($opts{'abstract'})
972 0 1 exists &{"${qname}::BUILD";} ? :
976 1 7 if ((ref $_[0] || $_[0]) eq $qname and $_[1] eq "new")
980 1 1 if (ref $_[0] eq $qname)
986 15 124 if (defined $opts{'subclass'})
997 0 204 if (my $hook = $opts{'end'})
999 0 0 is_HashRef($_) ? :
0 0 is_ArrayRef($hook) ? :
1002 0 0 $opts{'is_role'} ? :
1006 8 187 if ($opts{'type_library'} and $opts{'type_name'})
1007 0 8 $opts{'is_role'} ? :
1008 8 0 if $mytype
1017 1 7 $spec{'is_role'} || do {
1025 5 3 $package->can('FACTORY') ? :
0 8 exists $spec{'factory_package'} ? :
1029 1 5 unless ${"${package}::PREFIX";}
2 6 exists $spec{'prefix'} ? :
1033 2 6 unless ${"${package}::TOOLKIT";}
0 8 exists $spec{'toolkit'} ? :
1035 0 8 if (my $version = delete $spec{'version'})
1040 0 8 if (my $auth = delete $spec{'authority'})
1045 1 7 if ($kind eq "class" and my $extends = delete $spec{'extends'})
1047 1 0 if ($package->isa("${toolkit}::Object")) { }
1058 0 8 if ($kind eq "class" and my $overload = delete $spec{'overload'})
1064 8 0 unless delete $spec{'coerce'}
0 8 if (my(@coercions) = @{[] unless delete $spec{'coerce'};})
1069 0 0 if (is_CodeRef($coercions[0]) or is_HashRef($coercions[0]))
1080 4 4 if (my $methods = delete $spec{'can'})
1084 1 7 if (my $constants = delete $spec{'constant'})
1088 1 7 if (my $atts = delete $spec{'has'})
1092 0 8 if (my $symm = delete $spec{'symmethod'})
1096 1 7 if (my $multimethods = delete $spec{'multimethod'})
1103 2 6 if (defined $spec{'with'})
1105 2 0 if (@roles)
1108 0 2 if (@roles > 1 and ref $roles[1]) { }
1123 7 1 if ($kind eq "class")
1125 0 7 if ($fp and my $factory = delete $spec{'factory'})
1129 0 7 if ($fp and my $factory = delete $spec{'multifactory'})
1133 0 0 unless my $old_coderef = $method_spec->{'code'}
1143 20 4 unless my(@mm) = delete $spec{$modifier}->$_handle_list
1147 0 8 if (is_ArrayRef($mm[0])) { }
4 4 elsif (is_Str($mm[0])) { }
1175 3 204 if (is_CodeRef($coderef)) { }
194 10 elsif (is_ScalarRef($coderef)) { }
10 0 elsif (is_HashRef($coderef)) { }
1176 0 3 unless eval "package $fpackage; sub $name :method { splice(\@_, 1, 0, '${qname}'); goto \$coderef }; 1"
1181 179 15 if ($target eq 1)
1183 0 179 if $fpackage->can($name)
1186 0 194 unless eval "package $fpackage; sub $name :method { shift; '${qname}'->$target(\@_) }; 1"
1193 0 10 if (match("coercion", $meta{'attributes'}) or match("coerce", $meta{'attributes'}))
1199 0 0 unless is_ArrayRef($meta{'signature'}) and 1 == @sigtypes and not $meta{'named'}
1201 0 0 if $to_type->coercion->frozen
1228 0 207 unless eval "\n\t\t\tpackage $factory;\n\t\t\tno warnings 'redefine';\n\t\t\tsub _generate_$method :method {\n\t\t\t\tsub { q[$factory]->$method( \@_ ) };\n\t\t\t}\n\t\t\t1;\n\t\t"
1245 0 4 unless my $gen = $opts{'generator'}
1247 2 2 $opts{'is_role'} ? :
1269 4 0 if ($opts{'factory_package'})
1276 4 0 unless (exists $opts{'factory'})
1299 6 0 @_ == 1 ? :
1307 10 122 if (exists $local_opts{$key})
1312 0 6 if (keys %local_opts)
1321 4 2 unless exists $_generate_counter{$generator_package}
1329 4 2 if ($kind eq "class")
1334 2 4 if ($kind eq 'role') { }
1346 9 125 if $_cached_moo_helper{"${package}::$helpername"}
1347 0 125 unless $helpername =~ /^(has|with|extends|around|before|after|requires)$/
1349 17 108 $is_role ? :
1350 0 125 if (ref $tracker)
1354 17 108 $is_role ? :
17 108 $is_role ? :
1361 0 125 unless $_cached_moo_helper{"${package}::$helpername"}
1369 1 0 if ${"${qname}::TOOLKIT";}
1372 0 0 if $qname->isa("${tk}::Object")
1376 0 0 if (my $detected = "Role::Hooks"->is_role($qname))
1377 0 0 if $detected eq "Role::Tiny"
1378 0 0 if $detected eq "Moo::Role"
1379 0 0 if $detected eq "Moose::Role"
1380 0 0 if $detected eq "Mouse::Role"
1390 1 3 if ${"${qname}::PREFIX";}
1399 1 0 if ${"${qname}::TYPES";}
1405 0 0 unless ${"${qname}::FACTORY";}
1407 0 0 if $factory and $factory->can("type_library")
1426 5 26 $toolkit eq 'Mouse' ? :
6 31 $toolkit eq 'Moose' ? :
1430 0 37 if ($meta and $meta->is_immutable)
1439 8 50 if ($attrname =~ /^(\+?)(\$|\%|\@)(.+)$/)
1448 9 49 if ($attrname =~ /^(.+)\!$/)
1454 0 58 $attrname =~ /^_/ ? :
1458 10 46 is_Object($attrspec) && $attrspec->can('check') ? :
2 56 is_CodeRef($attrspec) ? :
1461 3 55 if (is_CodeRef($spec{'builder'}))
1467 0 3 if (defined $spec{'clearer'} and not ref $spec{'clearer'} and $spec{'clearer'} eq 1)
1474 1 57 if ($spec{'is'} eq 'lazy') { }
2 55 elsif ($spec{'is'} eq 'private') { }
1477 1 0 unless exists $spec{'default'}
1486 0 58 if ($spec{'does'})
1488 0 0 if $types
1492 7 51 if ($spec{'isa'} and not ref $spec{'isa'})
1494 7 0 if $types
1498 8 50 if ($spec{'enum'})
1502 3 55 if (is_Object($spec{'type'}) and $spec{'type'}->can('check')) { }
9 46 elsif ($spec{'type'}) { }
1510 7 41 if (ref $spec{'isa'} and not exists $spec{'coerce'} and $spec{'isa'}->has_coercion)
1514 23 35 if ($toolkit ne "Moo")
1515 1 0 if (defined $spec{'trigger'} and not ref $spec{'trigger'} and $spec{'trigger'} eq 1)
1518 1 22 if (defined $spec{'trigger'} and not ref $spec{'trigger'})
1522 0 23 if ($spec{'is'} eq "rwp")
1524 0 0 unless exists $spec{'writer'}
1528 1 57 if (is_CodeRef($spec{'coerce'}))
1533 0 58 if (is_ScalarRef($spec{'default'}))
1539 0 58 if (is_Object($spec{'default'}) and $spec{'default'}->isa("Ask::Question"))
1543 0 0 if ($spec{'isa'} and not $default->has_type)
1546 0 0 unless ($default->has_spec)
1549 0 0 unless ($default->has_title)
1556 0 58 if ($toolkit eq 'Mouse' and is_Object($spec{'default'})) { }
0 70 elsif ($toolkit eq 'Moose' and is_Object($spec{'default'}) and not $spec{'default'}->isa('Class::MOP::Method')) { }
1564 0 58 if ($default_codulate)
1566 0 0 if (is_CodeRef($deref))
1571 2 56 if ($spec{'lexical'}) { }
1573 1 1 if ($spec{'traits'} or $spec{'handles_via'})
1587 5 51 if ($spec{'handles_via'})
1593 5 51 if $shv_data
1594 1 55 if $lex
1598 0 37 if $make_immutable
1607 3 277 if (is_ScalarRef($spec->{$thing}))
1614 1 55 if (is_ArrayRef($spec->{'handles'}))
1619 2 1 if (is_ScalarRef($src)) { }
1631 55 1 unless keys %lex
1650 1 3 if (is_Object($spec->{'isa'}) and $spec->{'isa'}->isa("Type::Tiny::Enum") and $spec->{'handles'})
1661 1 0 if (delete $new_spec{'moox_enumeration_process_handles'})
1670 0 2 if (is_Object($spec->{'isa'}) and $spec->{'isa'}->isa('Type::Tiny::Enum') || $spec->{'isa'}->isa('Moose::Meta::TypeConstraint::Enum') and $spec->{'handles'})
1687 0 2 if (is_Object($spec->{'isa'}) and $spec->{'isa'}->isa("Type::Tiny::Enum") and $spec->{'handles'})
1712 18 0 if $parent->isa("Moose::Object")
1713 0 0 if $parent->isa("Moo::Object")
1727 18 0 if $parent->isa("Mouse::Object")
1740 0 10 unless my(@symm) = $symm->$_handle_list
1746 5 9 is_CodeRef($symm[0]) ? :
1748 2 12 if ($spec->{'signature'})
1751 2 0 $spec->{'named'} ? :
0 2 &CodeRef()->check($spec->{'signature'}) ? :
1757 2 0 exists $spec->{'signature'} ? :
1777 0 10 $method_spec->{'named'} ? :
0 10 &CodeRef()->check($method_spec->{'signature'}) ? :
1789 0 10 if (match("coercion", $method_spec->{'attributes'}) or match("coerce", $method_spec->{'attributes'}))
1795 0 0 unless is_ArrayRef($method_spec->{'signature'}) and 1 == @sigtypes and $signature_style eq "positional"
1797 0 0 if $to_type->coercion->frozen
1841 2 44 if $INC{'Sub/MultiMethod.pm'}
1850 0 16 if $INC{'Sub/MultiMethod.pm'}
1860 0 16 if $INC{'Sub/MultiMethod.pm'}
1887 1 0 @_ == 1 ? :
1906 169 39 if (is_CodeRef($methods->{$name})) { }
39 0 elsif (is_HashRef($methods->{$name})) { }
1914 29 10 unless $methods->{$name}{'curry'}
1915 1 38 exists $methods->{$name}{'invocant_count'} ? :
1918 1 37 $methods->{$name}{'named'} ? :
1 38 is_CodeRef($signature) ? :
1924 6 202 if ($signature)
1925 1 5 if $signature_style eq "code"
1926 1 5 if $signature_style eq "named"
1927 4 2 if $signature_style eq "positional"
1932 2 4 if ($signature and $methods->{$name}{'optimize'})
1933 2 0 if (my $r = $builder->_optimize_signature($class, "${class}::$name", $signature_style, $signature))
1940 203 5 if (is_CodeRef($code)) { }
1945 1 4 if defined $caller
1948 1 207 $is_coderef ? :
1949 3 205 if match("lvalue", $attrs)
1952 21 187 if ($ctx)
1957 4 204 $signature && !$optimized ? :
1 207 $is_coderef ? :
6 202 $signature ? :
4 204 $signature && !$optimized ? :
1 5 @curry ? :
9 193 @curry ? :
6 202 $signature ? :
1 207 $is_coderef ? :
1990 0 208 unless $return{$name} = eval $subcode
1993 0 208 if (match("coercion", $attrs) or match("coerce", $attrs))
1998 0 0 unless is_ArrayRef($signature) and 1 == @sigtypes and $signature_style eq "positional"
2001 0 0 if $to_type->coercion->frozen
2018 0 7 unless $signature
2020 1 5 if $signature_style eq "none"
2021 0 6 if $signature_style eq "code"
2026 0 6 if is_HashRef($sig[0])
2030 4 2 if keys %{$$details{"environment"};}
2031 1 4 if $details->{'source'} =~ /return/
2033 2 2 unless $details->{'source'} =~ /^sub \{(.+)\};?$/s
2043 3 21 unless $signature
2045 0 23 if $signature_style eq "none"
2046 2 21 if $signature_style eq "code"
2052 4 17 if is_HashRef($sig[0])
2063 5 23 if ($is_named) { }
2069 0 30 if (is_HashRef($sig[0]))
2074 15 13 if (is_Str($type) and not $type =~ /^[01]$/)
2080 0 16 if ($type =~ /^\%/) { }
0 15 elsif ($type =~ /^\@/) { }
2096 5 23 $is_named ? :
2104 0 38 if (ref $global_opts->{$position})
2113 0 0 if (ref $type) { }
0 0 elsif ($type =~ /^\%/) { }
0 0 elsif ($type =~ /^\@/) { }
2133 3 16 $is_named ? :
2135 12 7 if $gimme_list
2145 15 0 if (defined $value and not ref $value) { }
2148 0 15 unless eval "package $class; sub $name () { $stringy }; 1"
2152 0 0 unless eval "package $class; sub $name () { \$value }; 1"
2160 22 2 if is_CodeRef($method)
2164 2 0 unless $method->{'curry'}
2165 0 2 $method->{'named'} ? :
2167 0 2 unless $signature or @curry
2171 0 2 if exists $method->{'invocant_count'}
2185 0 2 unless $wrapped