lib/Mite/Signature.pm.mite.pm

filter: Statementstmt 69.3% 165 / 238 Branchbran 46.0% 59 / 128 Conditioncond 31.6% 38 / 120 MC/DCmcdc 0.0% 0 / 65 Subroutinesub 47.8% 22 / 46 Podpod 0.0% 0 / 13 totaltotal 46.5% 284 / 610 CC 100 SCAR 42.9
CC
100
Cov
54%
new
198.5
DOES
72.0
DESTROY
41.9
CRAP 73.3
« lib/Mite/Compiled.pm.mite.pm ↑ Summary lib/Mite/App/Command/exec.pm »
1 {
2  
3 16 package Mite::Signature;
4 16 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶ no warnings qw( once void );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 our $USES_MITE = "Mite::Class";
9 16 our $MITE_SHIM = "Mite::Shim";
10 16 our $MITE_VERSION = "0.013000";
11  
12 # Mite keywords
13 16 ▶ BEGIN {
Subroutine BEGIN: called CC=1 SCAR=1.2
14 16 my ( $SHIM, $CALLER ) = ( "Mite::Shim", "Mite::Signature" );
15 (
16 *after, *around, *before, *extends, *field,
17 *has, *param, *signature_for, *with
18 )
19 16 = do {
20  
21 package Mite::Shim;
22 16 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 (
24 0 ▶ sub { $SHIM->HANDLE_after( $CALLER, "class", @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 0 ▶ sub { $SHIM->HANDLE_around( $CALLER, "class", @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 0 ▶ sub { $SHIM->HANDLE_before( $CALLER, "class", @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 ▶ sub { },
Subroutine __ANON__: not called CC=1 SCAR=0.0
28 0 ▶ sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 176 ▶ sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
30 0 ▶ sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 0 ▶ sub { $SHIM->HANDLE_signature_for( $CALLER, "class", @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 ▶ sub { $SHIM->HANDLE_with( $CALLER, @_ ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 16 );
34 };
35 }
36  
37 # Mite imports
38 16 ▶ BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
39 16 require Scalar::Util;
40 16 *STRICT = \&Mite::Shim::STRICT;
41 16 *bare = \&Mite::Shim::bare;
42 16 *blessed = \&Scalar::Util::blessed;
43 16 *carp = \&Mite::Shim::carp;
44 16 *confess = \&Mite::Shim::confess;
45 16 *croak = \&Mite::Shim::croak;
46 16 *false = \&Mite::Shim::false;
47 16 *guard = \&Mite::Shim::guard;
48 16 *lazy = \&Mite::Shim::lazy;
49 16 *lock = \&Mite::Shim::lock;
50 16 *ro = \&Mite::Shim::ro;
51 16 *rw = \&Mite::Shim::rw;
52 16 *rwp = \&Mite::Shim::rwp;
53 16 *true = \&Mite::Shim::true;
54 16 *unlock = \&Mite::Shim::unlock;
55 }
56  
57 # Gather metadata for constructor and destructor
58 7 ▶ sub __META__ {
Subroutine __META__: called CC=4 SCAR=14.3
59 16 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
60 7 my $class = shift;
61 7 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
070
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
62 7 my $linear_isa = mro::get_linear_isa($class);
63 return {
64 BUILD => [
65 7 ▶ map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
Branch: 1 branch
BranchTrueFalseTotal
*{$_;}{'CODE'} ? : 7 0 7
66 7 map { "$_\::BUILD" } reverse @$linear_isa
67 ],
68 DEMOLISH => [
69 0 ▶ map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () }
Branch: 1 branch
BranchTrueFalseTotal
*{$_;}{'CODE'} ? : 0 7 7
70 7 map { "$_\::DEMOLISH" } @$linear_isa
71 ],
72 HAS_BUILDARGS => $class->can('BUILDARGS'),
73 HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'),
74 };
75 }
76  
77 # Standard Moose/Moo-style constructor
78 9 ▶ sub new {
Subroutine new: called CC=47 SCAR=52.9
Pod undocumented
79 9 ▶ my $class = ref( $_[0] ) ? ref(shift) : shift;
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 9 9
80 9 ▶ my $meta = ( $Mite::META{$class} ||= $class->__META__ );
Condition66%2/3
$Mite::META{$class} ||= $class->__META__
l!l&&r!l&&!r
270
MC/DC0%0/2
$Mite::META{$class} ||= $class->__META__
$Mite::META{$class} $class->__META__
Truth table66%2/3
A ||= B
A= $Mite::META{$class}B= $class->__META__
ABresult
1X1
011
000
81 9 my $self = bless {}, $class;
82 my $args =
83 $meta->{HAS_BUILDARGS}
84 ? $class->BUILDARGS(@_)
85 0 ▶ : { ( @_ == 1 ) ? %{ $_[0] } : @_ };
Branch: 2 branches
BranchTrueFalseTotal
$meta->{'HAS_BUILDARGS'} ? : 0 9 9
@_ == 1 ? : 0 9 9
86 9 my $no_build = delete $args->{__no_BUILD__};
87  
88 # Attribute class (type: Mite::Package)
89 # has declaration, file lib/Mite/Signature.pm, line 11
90 9 ▶ if ( exists $args->{"class"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"class"}) 9 0 9
91 blessed( $args->{"class"} )
92 9 ▶ && $args->{"class"}->isa("Mite::Package")
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($args->{"class"}) and $args->{"class"}->isa("Mite::Package") or croak("Type check failed in constructor: %s should be %s", "class", "Mite::Package") 9 0 9
Condition33%1/3
builtin::blessed($args->{"class"}) and $args->{"class"}->isa("Mite::Package")
!ll&&!rl&&r
009
MC/DC0%0/2
builtin::blessed($args->{"class"}) and $args->{"class"}->isa("Mite::Package")
builtin::blessed($args->{"class"}) $args->{"class"}->isa("Mite::Package")
Truth table33%1/3
A and B
A= builtin::blessed($args->{"class"})B= $args->{"class"}->isa("Mite::Package")
ABresult
0X0
100
111
93 or croak "Type check failed in constructor: %s should be %s",
94 "class", "Mite::Package";
95 9 $self->{"class"} = $args->{"class"};
96 }
97 require Scalar::Util && Scalar::Util::weaken( $self->{"class"} )
98 9 ▶ if ref $self->{"class"};
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"class"} 9 0 9
Condition33%2/6
ref $self->{'class'} && (require Scalar::Util && builtin::weaken($self->{'class'}))
!ll&&!rl&&r
090
require Scalar::Util and builtin::weaken($self->{"class"})
!ll&&!rl&&r
090
MC/DC0%0/3
ref $self->{'class'} && (require Scalar::Util && builtin::weaken($self->{'class'}))
ref $self->{'class'} require Scalar::Util builtin::weaken($self->{"class"})
Truth table0%0/4
A && B and C
A= ref $self->{'class'}B= require Scalar::UtilC= builtin::weaken($self->{"class"})
ABCresult
0XX0
10X0
1100
1111
99  
100 # Attribute method_name (type: Str)
101 # has declaration, file lib/Mite/Signature.pm, line 22
102 croak "Missing key in constructor: method_name"
103 9 ▶ unless exists $args->{"method_name"};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{"method_name"} 0 9 9
104 9 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; defined $args->{"method_name"} and do { ref \$args->{"method_name"} eq "SCALAR" or ref \(my $val = $args->{"method_name"}) eq "SCALAR" } } or croak("Type check failed in constructor: %s should be %s", "method_name", "Str") 9 0 9
105  
106 package Mite::Shim;
107 9 ▶ defined( $args->{"method_name"} ) and do {
Condition33%1/3
defined $args->{'method_name'} && do { ref \$args->{'method_name'} eq 'SCALAR' or ref \(my $val = $args->{'method_name'}) eq 'SCALAR' }
!ll&&!rl&&r
009
MC/DC0%0/2
defined $args->{'method_name'} && do { ref \$args->{'method_name'} eq 'SCALAR' or ref \(my $val = $args->{'method_name'}) eq 'SCALAR' }
defined $args->{'method_name'} do { ref \$args->{'method_name'} eq 'SCALAR' or ref \(my $val = $args->{'method_name'}) eq 'SCALAR' }
Truth table33%1/3
A && B
A= defined $args->{'method_name'}B= do { ref \$args->{'method_name'} eq 'SCALAR' or ref \(my $val = $args->{'method_name'}) eq 'SCALAR' }
ABresult
0X0
100
111
108 ref( \$args->{"method_name"} ) eq 'SCALAR'
109 9 ▶ or ref( \( my $val = $args->{"method_name"} ) ) eq 'SCALAR';
Condition33%1/3
ref \$args->{'method_name'} eq 'SCALAR' || ref \(my $val = $args->{'method_name'}) eq 'SCALAR'
l!l&&r!l&&!r
900
MC/DC0%0/2
ref \$args->{'method_name'} eq 'SCALAR' || ref \(my $val = $args->{'method_name'}) eq 'SCALAR'
ref \$args->{'method_name'} eq 'SCALAR' ref \(my $val = $args->{'method_name'}) eq 'SCALAR'
Truth table33%1/3
A || B
A= ref \$args->{'method_name'} eq 'SCALAR'B= ref \(my $val = $args->{'method_name'}) eq 'SCALAR'
ABresult
1X1
011
000
110 }
111 }
112 or croak "Type check failed in constructor: %s should be %s",
113 "method_name", "Str";
114 9 $self->{"method_name"} = $args->{"method_name"};
115  
116 # Attribute named (type: ArrayRef)
117 # has declaration, file lib/Mite/Signature.pm, line 27
118 9 ▶ if ( exists $args->{"named"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"named"}) 6 3 9
119 6 ▶ do { package Mite::Shim; ref( $args->{"named"} ) eq 'ARRAY' }
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; ref $args->{"named"} eq "ARRAY" } or croak("Type check failed in constructor: %s should be %s", "named", "ArrayRef") 6 0 6
120 or croak "Type check failed in constructor: %s should be %s",
121 "named", "ArrayRef";
122 6 $self->{"named"} = $args->{"named"};
123 }
124  
125 # Attribute positional (type: ArrayRef)
126 # has declaration, file lib/Mite/Signature.pm, line 32
127 9 my $args_for_positional = {};
128 9 for ( "positional", "pos" ) {
129 18 ▶ next unless exists $args->{$_};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{$_} 15 3 18
130 3 $args_for_positional->{"positional"} = $args->{$_};
131 3 last;
132 }
133 9 ▶ if ( exists $args_for_positional->{"positional"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args_for_positional->{"positional"}) 3 6 9
134 3 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; ref $args_for_positional->{"positional"} eq "ARRAY" } or croak("Type check failed in constructor: %s should be %s", "positional", "ArrayRef") 3 0 3
135  
136 package Mite::Shim;
137 3 ref( $args_for_positional->{"positional"} ) eq 'ARRAY';
138 }
139 or croak "Type check failed in constructor: %s should be %s",
140 "positional", "ArrayRef";
141 3 $self->{"positional"} = $args_for_positional->{"positional"};
142 }
143  
144 # Attribute method (type: Bool)
145 # has declaration, file lib/Mite/Signature.pm, line 38
146 9 do {
147 9 ▶ my $value = exists( $args->{"method"} ) ? $args->{"method"} : true;
Branch: 1 branch
BranchTrueFalseTotal
exists $args->{'method'} ? : 2 7 9
148 (
149 9 ▶ !ref $value
Branch: 1 branch
BranchTrueFalseTotal
not ref $value and !defined($value) || $value eq "" || $value eq 0 || $value eq 1 or croak("Type check failed in constructor: %s should be %s", "method", "Bool") 9 0 9
Condition58%7/12
not ref $value and !defined($value) || $value eq "" || $value eq 0 || $value eq 1
!ll&&!rl&&r
009
not defined $value or $value eq "" or $value eq 0 or $value eq 1
l!l&&r!l&&!r
180
not defined $value or $value eq "" or $value eq 0
l!l&&r!l&&!r
108
not defined $value or $value eq ""
l!l&&r!l&&!r
018
MC/DC0%0/5
not ref $value and !defined($value) || $value eq "" || $value eq 0 || $value eq 1
not ref $value not defined $value $value eq "" $value eq 0 $value eq 1
Truth table33%2/6
not(A) and not(B) or C or D or E
A= not ref $valueB= not defined $valueC= $value eq ""D= $value eq 0E= $value eq 1
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
150 and ( !defined $value
151 or $value eq q()
152 or $value eq '0'
153 or $value eq '1' )
154 )
155 or croak "Type check failed in constructor: %s should be %s",
156 "method", "Bool";
157 9 $self->{"method"} = $value;
158 };
159  
160 # Attribute head (type: ArrayRef|Int)
161 # has declaration, file lib/Mite/Signature.pm, line 46
162 9 ▶ if ( exists $args->{"head"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"head"}) 1 8 9
163 1 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; do { ref $args->{"head"} eq "ARRAY" } or do { my $tmp = $args->{"head"}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ } } or croak("Type check failed in constructor: %s should be %s", "head", "ArrayRef|Int") 1 0 1
164  
165 package Mite::Shim;
166 (
167 1 do { package Mite::Shim; ref( $args->{"head"} ) eq 'ARRAY' }
168 or (
169 1 ▶ do {
Condition33%1/3
do { ref $args->{'head'} eq 'ARRAY' } || do { my $tmp = $args->{'head'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
l!l&&r!l&&!r
100
MC/DC0%0/2
do { ref $args->{'head'} eq 'ARRAY' } || do { my $tmp = $args->{'head'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
do { ref $args->{'head'} eq 'ARRAY' } do { my $tmp = $args->{'head'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
Truth table33%1/3
A || B
A= do { ref $args->{'head'} eq 'ARRAY' }B= do { my $tmp = $args->{'head'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
ABresult
1X1
011
000
170 0 my $tmp = $args->{"head"};
171 0 ▶ defined($tmp)
Condition0%0/6
defined $tmp && !ref($tmp) && $tmp =~ /\A-?[0-9]+\z/
!ll&&!rl&&r
000
defined $tmp and not ref $tmp
!ll&&!rl&&r
000
MC/DC0%0/3
defined $tmp && !ref($tmp) && $tmp =~ /\A-?[0-9]+\z/
defined $tmp not ref $tmp $tmp =~ /\A-?[0-9]+\z/
Truth table0%0/4
A and not(B) && C
A= defined $tmpB= not ref $tmpC= $tmp =~ /\A-?[0-9]+\z/
ABCresult
0XX0
10X0
1100
1111
172 and !ref($tmp)
173 and $tmp =~ /\A-?[0-9]+\z/;
174 }
175 )
176 );
177 }
178 or croak "Type check failed in constructor: %s should be %s",
179 "head", "ArrayRef|Int";
180 1 $self->{"head"} = $args->{"head"};
181 }
182  
183 # Attribute tail (type: ArrayRef|Int)
184 # has declaration, file lib/Mite/Signature.pm, line 48
185 9 ▶ if ( exists $args->{"tail"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"tail"}) 0 9 9
186 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; do { ref $args->{"tail"} eq "ARRAY" } or do { my $tmp = $args->{"tail"}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ } } or croak("Type check failed in constructor: %s should be %s", "tail", "ArrayRef|Int") 0 0 0
187  
188 package Mite::Shim;
189 (
190 0 do { package Mite::Shim; ref( $args->{"tail"} ) eq 'ARRAY' }
191 or (
192 0 ▶ do {
Condition0%0/3
do { ref $args->{'tail'} eq 'ARRAY' } || do { my $tmp = $args->{'tail'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
l!l&&r!l&&!r
000
MC/DC0%0/2
do { ref $args->{'tail'} eq 'ARRAY' } || do { my $tmp = $args->{'tail'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
do { ref $args->{'tail'} eq 'ARRAY' } do { my $tmp = $args->{'tail'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
Truth table0%0/3
A || B
A= do { ref $args->{'tail'} eq 'ARRAY' }B= do { my $tmp = $args->{'tail'}; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
ABresult
1X1
011
000
193 0 my $tmp = $args->{"tail"};
194 0 ▶ defined($tmp)
Condition0%0/6
defined $tmp && !ref($tmp) && $tmp =~ /\A-?[0-9]+\z/
!ll&&!rl&&r
000
defined $tmp and not ref $tmp
!ll&&!rl&&r
000
MC/DC0%0/3
defined $tmp && !ref($tmp) && $tmp =~ /\A-?[0-9]+\z/
defined $tmp not ref $tmp $tmp =~ /\A-?[0-9]+\z/
Truth table0%0/4
A and not(B) && C
A= defined $tmpB= not ref $tmpC= $tmp =~ /\A-?[0-9]+\z/
ABCresult
0XX0
10X0
1100
1111
195 and !ref($tmp)
196 and $tmp =~ /\A-?[0-9]+\z/;
197 }
198 )
199 );
200 }
201 or croak "Type check failed in constructor: %s should be %s",
202 "tail", "ArrayRef|Int";
203 0 $self->{"tail"} = $args->{"tail"};
204 }
205  
206 # Attribute named_to_list (type: Bool|ArrayRef)
207 # has declaration, file lib/Mite/Signature.pm, line 52
208 9 do {
209 my $value =
210 exists( $args->{"named_to_list"} )
211 9 ▶ ? $args->{"named_to_list"}
Branch: 1 branch
BranchTrueFalseTotal
exists $args->{'named_to_list'} ? : 2 7 9
212 : "";
213 9 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; not ref $value and !defined($value) || $value eq "" || $value eq 0 || $value eq 1 or ref $value eq "ARRAY" } or croak("Type check failed in constructor: %s should be %s", "named_to_list", "Bool|ArrayRef") 9 0 9
214  
215 package Mite::Shim;
216 (
217 (
218 9 ▶ !ref $value
Condition53%8/15
!ref($value) && (!defined($value) || $value eq '' || $value eq '0' || $value eq '1') || ref $value eq 'ARRAY'
l!l&&r!l&&!r
900
not ref $value and !defined($value) || $value eq "" || $value eq 0 || $value eq 1
!ll&&!rl&&r
009
not defined $value or $value eq "" or $value eq 0 or $value eq 1
l!l&&r!l&&!r
810
not defined $value or $value eq "" or $value eq 0
l!l&&r!l&&!r
801
not defined $value or $value eq ""
l!l&&r!l&&!r
081
MC/DC0%0/6
!ref($value) && (!defined($value) || $value eq '' || $value eq '0' || $value eq '1') || ref $value eq 'ARRAY'
not ref $value not defined $value $value eq "" $value eq 0 $value eq 1 ref $value eq 'ARRAY'
Truth table25%2/8
not(A) and not(B) or C or D or E || F
A= not ref $valueB= not defined $valueC= $value eq ""D= $value eq 0E= $value eq 1F= ref $value eq 'ARRAY'
ABCDEFresult
11XXXX1
101XXX1
1001XX1
10001X1
0XXXX11
1000011
0XXXX00
1000000
219 and ( !defined $value
220 or $value eq q()
221 or $value eq '0'
222 or $value eq '1' )
223 )
224 or ( ref($value) eq 'ARRAY' )
225 );
226 }
227 or croak "Type check failed in constructor: %s should be %s",
228 "named_to_list", "Bool|ArrayRef";
229 9 $self->{"named_to_list"} = $value;
230 };
231  
232 # Call BUILD methods
233 9 ▶ $self->BUILDALL($args) if ( !$no_build and @{ $meta->{BUILD} || [] } );
Branch: 1 branch
BranchTrueFalseTotal
if not $no_build and @{$meta->{"BUILD"} or [];} 9 0 9
Condition40%2/5
not $no_build and @{$meta->{"BUILD"} or [];}
!ll&&!rl&&r
009
$meta->{'BUILD'} || []
l!l
90
MC/DC0%0/2
not $no_build and @{$meta->{"BUILD"} or [];}
not $no_build @{$meta->{"BUILD"} or [];}
MC/DC0%0/1
$meta->{'BUILD'} || []
$meta->{'BUILD'}
Truth table33%1/3
not(A) and B
A= not $no_buildB= @{$meta->{"BUILD"} or [];}
ABresult
0X0
100
111
Truth table50%1/2
A
A= $meta->{'BUILD'}
Aresult
11
00
234  
235 # Unrecognized parameters
236 my @unknown = grep not(
237 /\A(?:class|head|method(?:_name)?|named(?:_to_list)?|pos(?:itional)?|tail)\z/
238 9 ), keys %{$args};
239 @unknown
240 9 ▶ and croak(
Branch: 1 branch
BranchTrueFalseTotal
@unknown and croak('Unexpected keys in constructor: ' . join(", ", sort(@unknown))) 0 9 9
241 "Unexpected keys in constructor: " . join( q[, ], sort @unknown ) );
242  
243 9 return $self;
244 }
245  
246 # Used by constructor to call BUILD methods
247 9 ▶ sub BUILDALL {
Subroutine BUILDALL: called CC=4 SCAR=15.2
Pod undocumented
248 9 my $class = ref( $_[0] );
249 9 ▶ my $meta = ( $Mite::META{$class} ||= $class->__META__ );
Condition33%1/3
$Mite::META{$class} ||= $class->__META__
l!l&&r!l&&!r
900
MC/DC0%0/2
$Mite::META{$class} ||= $class->__META__
$Mite::META{$class} $class->__META__
Truth table33%1/3
A ||= B
A= $Mite::META{$class}B= $class->__META__
ABresult
1X1
011
000
250 9 ▶ $_->(@_) for @{ $meta->{BUILD} || [] };
Condition50%1/2
$meta->{'BUILD'} || []
l!l
90
MC/DC0%0/1
$meta->{'BUILD'} || []
$meta->{'BUILD'}
Truth table50%1/2
A
A= $meta->{'BUILD'}
Aresult
11
00
251 }
252  
253 # Destructor should call DEMOLISH methods
254 0 ▶ sub DESTROY {
Subroutine DESTROY: not called CC=7 SCAR=37.3
255 0 my $self = shift;
256 0 ▶ my $class = ref($self) || $self;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
257 0 ▶ my $meta = ( $Mite::META{$class} ||= $class->__META__ );
Condition0%0/3
$Mite::META{$class} ||= $class->__META__
l!l&&r!l&&!r
000
MC/DC0%0/2
$Mite::META{$class} ||= $class->__META__
$Mite::META{$class} $class->__META__
Truth table0%0/3
A ||= B
A= $Mite::META{$class}B= $class->__META__
ABresult
1X1
011
000
258 0 ▶ my $in_global_destruction =
Branch: 1 branch
BranchTrueFalseTotal
defined ${^GLOBAL_PHASE} ? : 0 0 0
259 defined ${^GLOBAL_PHASE}
260 ? ${^GLOBAL_PHASE} eq 'DESTRUCT'
261 : Devel::GlobalDestruction::in_global_destruction();
262 0 ▶ for my $demolisher ( @{ $meta->{DEMOLISH} || [] } ) {
Condition0%0/2
$meta->{'DEMOLISH'} || []
l!l
00
MC/DC0%0/1
$meta->{'DEMOLISH'} || []
$meta->{'DEMOLISH'}
Truth table0%0/2
A
A= $meta->{'DEMOLISH'}
Aresult
11
00
263 0 my $e = do {
264 0 local ( $?, $@ );
265 0 eval { $demolisher->( $self, $in_global_destruction ) };
266 0 $@;
267 };
268 16 ▶ no warnings 'misc'; # avoid (in cleanup) warnings
Subroutine BEGIN: called CC=1 SCAR=0.0
269 0 ▶ die $e if $e; # rethrow
Branch: 1 branch
BranchTrueFalseTotal
if $e 0 0 0
270 }
271 0 return;
272 }
273  
274 my $__XS = !$ENV{PERL_ONLY}
275 16 ▶ && eval { require Class::XSAccessor; Class::XSAccessor->VERSION("1.19") };
Condition33%1/3
!$ENV{'PERL_ONLY'} && eval { do { require Class::XSAccessor; 'Class::XSAccessor'->VERSION('1.19') } }
!ll&&!rl&&r
0016
MC/DC0%0/2
!$ENV{'PERL_ONLY'} && eval { do { require Class::XSAccessor; 'Class::XSAccessor'->VERSION('1.19') } }
!$ENV{'PERL_ONLY'} eval { do { require Class::XSAccessor; 'Class::XSAccessor'->VERSION('1.19') } }
Truth table33%1/3
not(A) && B
A= !$ENV{'PERL_ONLY'}B= eval { do { require Class::XSAccessor; 'Class::XSAccessor'->VERSION('1.19') } }
ABresult
0X0
100
111
276  
277 # Accessors for class
278 # has declaration, file lib/Mite/Signature.pm, line 11
279 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
280 16 Class::XSAccessor->import(
281 chained => 1,
282 "getters" => { "class" => "class" },
283 );
284 }
285 else {
286 0 ▶ *class = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
287 0 ▶ @_ == 1 or croak('Reader "class" usage: $self->class()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"class\" usage: \$self->class()") 0 0 0
288 0 $_[0]{"class"};
289 0 };
290 }
291  
292 # Accessors for compiler
293 # has declaration, file lib/Mite/Signature.pm, line 57
294 2 ▶ sub _assert_blessed_compiler {
Subroutine _assert_blessed_compiler: called CC=4 SCAR=14.0
295 2 my $object = do {
296 (
297 exists( $_[0]{"compiler"} ) ? $_[0]{"compiler"} : (
298 2 ▶ $_[0]{"compiler"} = do {
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'compiler'} ? : 1 1 2
299 1 my $default_value = $_[0]->_build_compiler;
300 1 ▶ blessed($default_value)
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($default_value) or croak("Type check failed in default: %s should be %s", "compiler", "Object") 1 0 1
301 or croak(
302 "Type check failed in default: %s should be %s",
303 "compiler", "Object" );
304 1 $default_value;
305 }
306 )
307 )
308 };
309 2 ▶ blessed($object) or croak("compiler is not a blessed object");
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($object) or croak("compiler is not a blessed object") 2 0 2
310 2 $object;
311 }
312  
313 14 ▶ sub compiler {
Subroutine compiler: called CC=4 SCAR=14.1
Pod undocumented
314 14 ▶ @_ == 1 or croak('Reader "compiler" usage: $self->compiler()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"compiler\" usage: \$self->compiler()") 14 0 14
315 (
316 exists( $_[0]{"compiler"} ) ? $_[0]{"compiler"} : (
317 14 ▶ $_[0]{"compiler"} = do {
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'compiler'} ? : 6 8 14
318 8 my $default_value = $_[0]->_build_compiler;
319 8 ▶ blessed($default_value)
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($default_value) or croak("Type check failed in default: %s should be %s", "compiler", "Object") 8 0 8
320 or croak( "Type check failed in default: %s should be %s",
321 "compiler", "Object" );
322 8 $default_value;
323 }
324 )
325 );
326 }
327  
328 # Delegated methods for compiler
329 # has declaration, file lib/Mite/Signature.pm, line 57
330 0 ▶ sub has_head { shift->_assert_blessed_compiler->has_head(@_) }
Subroutine has_head: not called CC=1 SCAR=6.9
Pod undocumented
331 2 ▶ sub has_slurpy { shift->_assert_blessed_compiler->has_slurpy(@_) }
Subroutine has_slurpy: called CC=1 SCAR=0.0
Pod undocumented
332 0 ▶ sub has_tail { shift->_assert_blessed_compiler->has_tail(@_) }
Subroutine has_tail: not called CC=1 SCAR=6.9
Pod undocumented
333  
334 # Accessors for compiling_class
335 # has declaration, file lib/Mite/Signature.pm, line 16
336 59 ▶ sub compiling_class {
Subroutine compiling_class: called CC=4 SCAR=14.6
Pod undocumented
337 @_ > 1
338 ? do {
339 10 ▶ blessed( $_[1] ) && $_[1]->isa("Mite::Package")
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($_[1]) and $_[1]->isa("Mite::Package") or croak("Type check failed in %s: value should be %s", "accessor", "Mite::Package") 10 0 10
Condition33%1/3
builtin::blessed($_[1]) and $_[1]->isa("Mite::Package")
!ll&&!rl&&r
0010
MC/DC0%0/2
builtin::blessed($_[1]) and $_[1]->isa("Mite::Package")
builtin::blessed($_[1]) $_[1]->isa("Mite::Package")
Truth table33%1/3
A and B
A= builtin::blessed($_[1])B= $_[1]->isa("Mite::Package")
ABresult
0X0
100
111
340 or croak( "Type check failed in %s: value should be %s",
341 "accessor", "Mite::Package" );
342 10 $_[0]{"compiling_class"} = $_[1];
343 10 $_[0];
344 }
345 59 ▶ : ( $_[0]{"compiling_class"} );
Branch: 1 branch
BranchTrueFalseTotal
@_ > 1 ? : 10 49 59
346 }
347  
348 10 ▶ sub locally_set_compiling_class {
Subroutine locally_set_compiling_class: called CC=4 SCAR=14.5
Pod undocumented
349 defined wantarray
350 10 ▶ or croak("This method cannot be called in void context");
Branch: 1 branch
BranchTrueFalseTotal
defined wantarray or croak("This method cannot be called in void context") 10 0 10
351 10 my $get = "compiling_class";
352 10 my $set = "compiling_class";
353 10 ▶ my $has = sub { exists $_[0]{"compiling_class"} };
Subroutine __ANON__: called CC=1 SCAR=0.0
354 10 ▶ my $clear = sub { delete $_[0]{"compiling_class"}; $_[0]; };
Subroutine __ANON__: called CC=1 SCAR=0.0
355 10 my $old = undef;
356 10 my ( $self, $new ) = @_;
357 my $restorer = $self->$has
358 ? do {
359 0 $old = $self->$get;
360 0 ▶ sub { $self->$set($old) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
361 0 }
362 10 ▶ : sub { $self->$clear };
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
$self->$has ? : 0 10 10
363 10 ▶ @_ == 2 ? $self->$set($new) : $self->$clear;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 10 0 10
364 10 &guard( $restorer, $old );
365 }
366  
367 # Accessors for head
368 # has declaration, file lib/Mite/Signature.pm, line 46
369 18 ▶ sub head {
Subroutine head: called CC=7 SCAR=26.4
Pod undocumented
370 18 ▶ @_ == 1 or croak('Reader "head" usage: $self->head()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"head\" usage: \$self->head()") 18 0 18
371 (
372 exists( $_[0]{"head"} ) ? $_[0]{"head"} : (
373 18 ▶ $_[0]{"head"} = do {
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'head'} ? : 10 8 18
374 8 my $default_value = $_[0]->_build_head;
375 8 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
do { package Mite::Shim; ref $default_value eq "ARRAY" or do { my $tmp = $default_value; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ } } or croak("Type check failed in default: %s should be %s", "head", "ArrayRef|Int") 8 0 8
376  
377 package Mite::Shim;
378 (
379 ( ref($default_value) eq 'ARRAY' ) or (
380 8 ▶ do {
Condition33%1/3
ref $default_value eq 'ARRAY' || do { my $tmp = $default_value; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
l!l&&r!l&&!r
800
MC/DC0%0/2
ref $default_value eq 'ARRAY' || do { my $tmp = $default_value; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
ref $default_value eq 'ARRAY' do { my $tmp = $default_value; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
Truth table33%1/3
A || B
A= ref $default_value eq 'ARRAY'B= do { my $tmp = $default_value; defined $tmp and not ref $tmp and $tmp =~ /\A-?[0-9]+\z/ }
ABresult
1X1
011
000
381 0 my $tmp = $default_value;
382 0 ▶ defined($tmp)
Condition0%0/6
defined $tmp && !ref($tmp) && $tmp =~ /\A-?[0-9]+\z/
!ll&&!rl&&r
000
defined $tmp and not ref $tmp
!ll&&!rl&&r
000
MC/DC0%0/3
defined $tmp && !ref($tmp) && $tmp =~ /\A-?[0-9]+\z/
defined $tmp not ref $tmp $tmp =~ /\A-?[0-9]+\z/
Truth table0%0/4
A and not(B) && C
A= defined $tmpB= not ref $tmpC= $tmp =~ /\A-?[0-9]+\z/
ABCresult
0XX0
10X0
1100
1111
383 and !ref($tmp)
384 and $tmp =~ /\A-?[0-9]+\z/;
385 }
386 )
387 );
388 }
389 or croak( "Type check failed in default: %s should be %s",
390 "head", "ArrayRef|Int" );
391 8 $default_value;
392 }
393 )
394 );
395 }
396  
397 # Accessors for method
398 # has declaration, file lib/Mite/Signature.pm, line 38
399 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
400 16 Class::XSAccessor->import(
401 chained => 1,
402 "getters" => { "method" => "method" },
403 );
404 }
405 else {
406 0 ▶ *method = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
407 0 ▶ @_ == 1 or croak('Reader "method" usage: $self->method()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"method\" usage: \$self->method()") 0 0 0
408 0 $_[0]{"method"};
409 0 };
410 }
411  
412 # Accessors for method_name
413 # has declaration, file lib/Mite/Signature.pm, line 22
414 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
415 16 Class::XSAccessor->import(
416 chained => 1,
417 "getters" => { "method_name" => "method_name" },
418 );
419 }
420 else {
421 0 ▶ *method_name = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
422 0 ▶ @_ == 1
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"method_name\" usage: \$self->method_name()") 0 0 0
423 or croak('Reader "method_name" usage: $self->method_name()');
424 0 $_[0]{"method_name"};
425 0 };
426 }
427  
428 # Accessors for named
429 # has declaration, file lib/Mite/Signature.pm, line 27
430 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
431 16 Class::XSAccessor->import(
432 chained => 1,
433 "exists_predicates" => { "is_named" => "named" },
434 "getters" => { "named" => "named" },
435 );
436 }
437 else {
438 0 ▶ *is_named = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
439 0 ▶ @_ == 1 or croak('Predicate "is_named" usage: $self->is_named()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Predicate \"is_named\" usage: \$self->is_named()") 0 0 0
440 0 exists $_[0]{"named"};
441 0 };
442 0 ▶ *named = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
443 0 ▶ @_ == 1 or croak('Reader "named" usage: $self->named()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"named\" usage: \$self->named()") 0 0 0
444 0 $_[0]{"named"};
445 0 };
446 }
447  
448 # Accessors for named_to_list
449 # has declaration, file lib/Mite/Signature.pm, line 52
450 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
451 16 Class::XSAccessor->import(
452 chained => 1,
453 "getters" => { "named_to_list" => "named_to_list" },
454 );
455 }
456 else {
457 0 ▶ *named_to_list = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
458 0 ▶ @_ == 1
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"named_to_list\" usage: \$self->named_to_list()") 0 0 0
459 or croak('Reader "named_to_list" usage: $self->named_to_list()');
460 0 $_[0]{"named_to_list"};
461 0 };
462 }
463  
464 # Accessors for positional
465 # has declaration, file lib/Mite/Signature.pm, line 32
466 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
467 16 Class::XSAccessor->import(
468 chained => 1,
469 "exists_predicates" => { "is_positional" => "positional" },
470 "getters" => { "positional" => "positional" },
471 );
472 }
473 else {
474 0 ▶ *is_positional = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
475 0 ▶ @_ == 1
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Predicate \"is_positional\" usage: \$self->is_positional()") 0 0 0
476 or
477 croak('Predicate "is_positional" usage: $self->is_positional()');
478 0 exists $_[0]{"positional"};
479 0 };
480 0 ▶ *positional = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
481 0 ▶ @_ == 1 or croak('Reader "positional" usage: $self->positional()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"positional\" usage: \$self->positional()") 0 0 0
482 0 $_[0]{"positional"};
483 0 };
484 }
485  
486 # Aliases for positional
487 # has declaration, file lib/Mite/Signature.pm, line 32
488 0 ▶ sub pos { shift->positional(@_) }
Subroutine pos: not called CC=1 SCAR=6.9
Pod undocumented
489  
490 # Accessors for should_bless
491 # has declaration, file lib/Mite/Signature.pm, line 68
492 18 ▶ sub should_bless {
Subroutine should_bless: called CC=8 SCAR=22.8
Pod undocumented
493 18 ▶ @_ == 1 or croak('Reader "should_bless" usage: $self->should_bless()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"should_bless\" usage: \$self->should_bless()") 18 0 18
494 (
495 exists( $_[0]{"should_bless"} ) ? $_[0]{"should_bless"} : (
496 18 ▶ $_[0]{"should_bless"} = do {
Branch: 1 branch
BranchTrueFalseTotal
exists $_[0]{'should_bless'} ? : 9 9 18
497 9 my $default_value = $_[0]->_build_should_bless;
498 (
499 9 ▶ !ref $default_value
Branch: 1 branch
BranchTrueFalseTotal
not ref $default_value and !defined($default_value) || $default_value eq "" || $default_value eq 0 || $default_value eq 1 or croak("Type check failed in default: %s should be %s", "should_bless", "Bool") 9 0 9
Condition58%7/12
not ref $default_value and !defined($default_value) || $default_value eq "" || $default_value eq 0 || $default_value eq 1
!ll&&!rl&&r
009
not defined $default_value or $default_value eq "" or $default_value eq 0 or $default_value eq 1
l!l&&r!l&&!r
450
not defined $default_value or $default_value eq "" or $default_value eq 0
l!l&&r!l&&!r
405
not defined $default_value or $default_value eq ""
l!l&&r!l&&!r
045
MC/DC0%0/5
not ref $default_value and !defined($default_value) || $default_value eq "" || $default_value eq 0 || $default_value eq 1
not ref $default_value not defined $default_value $default_value eq "" $default_value eq 0 $default_value eq 1
Truth table33%2/6
not(A) and not(B) or C or D or E
A= not ref $default_valueB= not defined $default_valueC= $default_value eq ""D= $default_value eq 0E= $default_value eq 1
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
500 and ( !defined $default_value
501 or $default_value eq q()
502 or $default_value eq '0'
503 or $default_value eq '1' )
504 )
505 or croak( "Type check failed in default: %s should be %s",
506 "should_bless", "Bool" );
507 9 $default_value;
508 }
509 )
510 );
511 }
512  
513 # Accessors for tail
514 # has declaration, file lib/Mite/Signature.pm, line 48
515 16 ▶ if ($__XS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($__XS) { } 16 0 16
516 16 Class::XSAccessor->import(
517 chained => 1,
518 "getters" => { "tail" => "tail" },
519 );
520 }
521 else {
522 0 ▶ *tail = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
523 0 ▶ @_ == 1 or croak('Reader "tail" usage: $self->tail()');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("Reader \"tail\" usage: \$self->tail()") 0 0 0
524 0 $_[0]{"tail"};
525 0 };
526 }
527  
528 # See UNIVERSAL
529 0 ▶ sub DOES {
Subroutine DOES: not called CC=8 SCAR=42.8
Pod undocumented
530 0 my ( $self, $role ) = @_;
531 0 our %DOES;
532 0 ▶ return $DOES{$role} if exists $DOES{$role};
Branch: 1 branch
BranchTrueFalseTotal
if exists $Mite::Signature::DOES{$role} 0 0 0
533 0 ▶ return 1 if $role eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if $role eq __PACKAGE__ 0 0 0
534 0 ▶ if ( $INC{'Moose/Util.pm'}
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"Moose/Util.pm"} and my $meta = Moose::Util::find_meta(ref $self || $self)) 0 0 0
Condition0%0/6
$INC{"Moose/Util.pm"} and my $meta = Moose::Util::find_meta(ref $self || $self)
!ll&&!rl&&r
000
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
$INC{"Moose/Util.pm"} and my $meta = Moose::Util::find_meta(ref $self || $self)
$INC{"Moose/Util.pm"} my $meta = Moose::Util::find_meta(ref $self || $self)
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A and B
A= $INC{"Moose/Util.pm"}B= my $meta = Moose::Util::find_meta(ref $self || $self)
ABresult
0X0
100
111
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
535 and my $meta = Moose::Util::find_meta( ref $self or $self ) )
536 {
537 0 ▶ $meta->can('does_role') and $meta->does_role($role) and return 1;
Branch: 1 branch
BranchTrueFalseTotal
$meta->can("does_role") and $meta->does_role($role) and return 1 0 0 0
Condition0%0/3
$meta->can("does_role") and $meta->does_role($role)
!ll&&!rl&&r
000
MC/DC0%0/2
$meta->can("does_role") and $meta->does_role($role)
$meta->can("does_role") $meta->does_role($role)
Truth table0%0/3
A and B
A= $meta->can("does_role")B= $meta->does_role($role)
ABresult
0X0
100
111
538 }
539 0 return $self->SUPER::DOES($role);
540 }
541  
542 # Alias for Moose/Moo-compatibility
543 0 ▶ sub does {
Subroutine does: not called CC=1 SCAR=6.9
Pod undocumented
544 0 shift->DOES(@_);
545 }
546  
547 16 1;
548 }
« lib/Mite/Compiled.pm.mite.pm ↑ Summary lib/Mite/App/Command/exec.pm »