blib/lib/Hades/Realm/OO.pm

filter: Statementstmt 66.1% 221 / 334 Branchbran 49.3% 145 / 294 Conditioncond 68.4% 104 / 152 MC/DCmcdc 55.0% 44 / 80 Subroutinesub 76.0% 35 / 46 Podpod 100% 35 / 35 totaltotal 62.0% 584 / 941 SCAR 80.8
CC
219
Cov
60%
unique_types
173.4
build_class_inheritance
56.0
build_accessor
46.4
CRAP 3229.9
↑ Summary
1 package Hades::Realm::OO;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base qw/Hades/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $VERSION = 0.05;
6  
7 sub new {
8 53 ▶ my ( $cls, %args ) = ( shift(), scalar @_ == 1 ? %{ $_[0] } : @_ );
Subroutine new: called CC=7 SCAR=20.4
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ == 1 ? : 52 1 53
9 53 my $self = $cls->SUPER::new(%args);
10 53 my %accessors = ( current_class => {}, meta => {}, is_role => {}, );
11 53 for my $accessor ( keys %accessors ) {
12 my $param
13 = defined $args{$accessor}
14 ? $args{$accessor}
15 146 ▶ : $accessors{$accessor}->{default};
Branch: 1 branch
BranchTrueFalseTotal
defined $args{$accessor} ? : 38 108 146
16 my $value
17 = $self->$accessor( $accessors{$accessor}->{builder}
18 146 ▶ ? $accessors{$accessor}->{builder}->( $self, $param )
Branch: 1 branch
BranchTrueFalseTotal
$accessors{$accessor}{'builder'} ? : 0 146 146
19 : $param );
20 130 ▶ unless ( !$accessors{$accessor}->{required} || defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (not $accessors{$accessor}{"required"} or defined $value) 0 130 130
Condition33%1/3
not $accessors{$accessor}{"required"} or defined $value
l!l&&r!l&&!r
13000
MC/DC0%0/2
not $accessors{$accessor}{"required"} or defined $value
not $accessors{$accessor}{"required"} defined $value
Truth table33%1/3
not(A) or B
A= not $accessors{$accessor}{"required"}B= defined $value
ABresult
1X1
011
000
21 0 die "$accessor accessor is required";
22 }
23 }
24 37 return $self;
25 }
26  
27 sub current_class {
28 55 ▶ my ( $self, $value ) = @_;
Subroutine current_class: called CC=3 SCAR=11.0
Pod documented
29 55 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 17 38 55
30 17 ▶ if ( ref $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value) 4 13 17
31 4 die qq{Str: invalid value $value for accessor current_class};
32 }
33 13 $self->{current_class} = $value;
34 }
35 51 return $self->{current_class};
36 }
37  
38 sub meta {
39 65 ▶ my ( $self, $value ) = @_;
Subroutine meta: called CC=15 SCAR=27.1
Pod documented
40 65 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 27 38 65
41 27 ▶ if ( ( ref($value) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $value || "") ne "HASH") 4 23 27
Condition100%2/2
ref $value || ''
l!l
252
MC/DC100%1/1
ref $value || ''
ref $value
Truth table100%2/2
A
A= ref $value
Aresult
11
00
42 4 die
43 qq{Map[Str, Dict[types => HashRef, attributes => HashRef]]: invalid value $value for accessor meta};
44 }
45 23 for my $key ( keys %{$value} ) {
46 23 my $val = $value->{$key};
47 23 ▶ if ( ref $key ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $key) 0 23 23
48 0 die
49 qq{Map[Str, Dict[types => HashRef, attributes => HashRef]]: invalid value $key for accessor meta expected Str};
50 }
51 23 ▶ if ( ( ref($val) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $val || "") ne "HASH") 6 17 23
Condition100%2/2
ref $val || ''
l!l
194
MC/DC100%1/1
ref $val || ''
ref $val
Truth table100%2/2
A
A= ref $val
Aresult
11
00
52 6 ▶ $val = defined $val ? $val : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val ? : 4 2 6
53 6 die
54 qq{Map[Str, Dict[types => HashRef, attributes => HashRef]]: invalid value $val for accessor meta expected Dict[types=>HashRef,attributes=>HashRef]};
55 }
56 17 ▶ if ( ( ref( $val->{types} ) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $val->{"types"} || "") ne "HASH") 8 9 17
Condition100%2/2
ref $val->{'types'} || ''
l!l
116
MC/DC100%1/1
ref $val->{'types'} || ''
ref $val->{'types'}
Truth table100%2/2
A
A= ref $val->{'types'}
Aresult
11
00
57 $val->{types}
58 8 ▶ = defined $val->{types} ? $val->{types} : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val->{'types'} ? : 4 4 8
59 8 die
60 qq{Map[Str, Dict[types => HashRef, attributes => HashRef]]: invalid value $val->{types} for accessor meta expected Dict[types=>HashRef,attributes=>HashRef] expected HashRef for types};
61 }
62 9 ▶ if ( ( ref( $val->{attributes} ) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $val->{"attributes"} || "") ne "HASH") 6 3 9
Condition100%2/2
ref $val->{'attributes'} || ''
l!l
54
MC/DC100%1/1
ref $val->{'attributes'} || ''
ref $val->{'attributes'}
Truth table100%2/2
A
A= ref $val->{'attributes'}
Aresult
11
00
63 $val->{attributes}
64 = defined $val->{attributes}
65 ? $val->{attributes}
66 6 ▶ : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $val->{'attributes'} ? : 4 2 6
67 6 die
68 qq{Map[Str, Dict[types => HashRef, attributes => HashRef]]: invalid value $val->{attributes} for accessor meta expected Dict[types=>HashRef,attributes=>HashRef] expected HashRef for attributes};
69 }
70 }
71 3 $self->{meta} = $value;
72 }
73 41 return $self->{meta};
74 }
75  
76 sub is_role {
77 53 ▶ my ( $self, $value ) = @_;
Subroutine is_role: called CC=8 SCAR=21.2
Pod documented
78 53 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 14 39 53
79 14 my $ref = ref $value;
80 14 ▶ if ( ( $ref || 'SCALAR' ) ne 'SCALAR'
Branch: 2 branches
BranchTrueFalseTotal
if (($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$value : $value) =~ /^(1|0)$/) 4 10 14
$ref ? : 0 10 10
Condition80%4/5
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$value : $value) =~ /^(1|0)$/
l!l&&r!l&&!r
4010
$ref || 'SCALAR'
l!l
410
MC/DC50%1/2
($ref || "SCALAR") ne "SCALAR" or not +($ref ? $$value : $value) =~ /^(1|0)$/
$ref not +($ref ? $$value : $value) =~ /^(1|0)$/
Truth table66%2/3
A or not(B)
A= $refB= not +($ref ? $$value : $value) =~ /^(1|0)$/
ABresult
1X1
011
000
81 || ( $ref ? $$value : $value ) !~ m/^(1|0)$/ )
82 {
83 4 die qq{Bool: invalid value $value for accessor is_role};
84 }
85 10 ▶ $value = !!( $ref ? $$value : $value ) ? 1 : 0;
Branch: 2 branches
BranchTrueFalseTotal
!!($ref ? $$value : $value) ? : 10 0 10
$ref ? : 0 10 10
86 10 $self->{is_role} = $value;
87 }
88 49 return $self->{is_role};
89 }
90  
91 sub clear_is_role {
92 1 ▶ my ($self) = @_;
Subroutine clear_is_role: called CC=1 SCAR=0.0
Pod documented
93 1 delete $self->{is_role};
94 1 return $self;
95 }
96  
97 sub module_generate {
98 2 ▶ my ( $self, $mg ) = @_;
Subroutine module_generate: called CC=4 SCAR=21.7
Pod documented
99 2 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 0 2
Condition100%2/2
ref $mg || ''
l!l
11
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
100 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
101 2 die
102 qq{Object: invalid value $mg for variable \$mg in method module_generate};
103 }
104  
105 $mg->keyword(
106 'has',
107 0 ▶ CODE => sub { $self->build_has(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
108 0 KEYWORDS => $self->build_has_keywords,
109 POD_TITLE => 'ATTRIBUTES',
110 POD_POD => 'Get or set $keyword',
111 POD_EXAMPLE => "\$obj->\$keyword;\n\n\t\$obj->\$keyword(\$value)"
112 );
113 $mg->keyword(
114 'extends',
115 0 ▶ CODE => sub { $self->build_extends(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
116 0 KEYWORDS => $self->build_extends_keywords,
117 POD_TITLE => 'EXTENDS',
118 POD_POD => 'This class extends the following classes',
119 POD_EXAMPLE => "\$keyword"
120 );
121 $mg->keyword(
122 'with',
123 0 ▶ CODE => sub { $self->build_with(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
124 0 KEYWORDS => $self->build_with_keywords,
125 POD_TITLE => 'WITH',
126 POD_POD => 'This class includes the following roles',
127 POD_EXAMPLE => "\$keyword"
128 );
129 $mg->keyword(
130 'requires',
131 0 ▶ CODE => sub { $self->build_requires(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
132 0 KEYWORDS => $self->build_requires_keywords,
133 POD_TITLE => 'REQUIRES',
134 POD_POD => 'This class requires:',
135 POD_EXAMPLE => "\$keyword"
136 );
137 $mg->keyword(
138 'before',
139 0 ▶ CODE => sub { $self->build_before(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
140 0 KEYWORDS => $self->build_before_keywords,
141 POD_TITLE => 'BEFORE',
142 POD_POD => 'Call $keyword method',
143 POD_EXAMPLE => "\$obj->\$keyword"
144 );
145 $mg->keyword(
146 'around',
147 0 ▶ CODE => sub { $self->build_around(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
148 0 KEYWORDS => $self->build_around_keywords,
149 POD_TITLE => 'AROUND',
150 POD_POD => 'Call $keyword method',
151 POD_EXAMPLE => "\$obj->\$keyword"
152 );
153 $mg->keyword(
154 'after',
155 0 ▶ CODE => sub { $self->build_after(@_) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
156 0 KEYWORDS => $self->build_after_keywords,
157 POD_TITLE => 'AFTER',
158 POD_POD => 'Call $keyword method',
159 POD_EXAMPLE => "\$obj->\$keyword"
160 );
161  
162 }
163  
164 sub build_class_inheritance {
165 0 ▶ my ( $orig, $self, @params ) = ( 'SUPER::build_class_inheritance', @_ );
Subroutine build_class_inheritance: not called CC=7 SCAR=40.3
Pod documented
166  
167 0 ▶ if ( $params[-1] =~ m/^(role)$/i ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($params[-1] =~ /^(role)$/i) { } 0 0 0
elsif ($params[-1] =~ /^(with|extends|parent|base)$/) { } 0 0 0
elsif ($params[-2] and $params[-2] =~ /^(with|extends)$/) { } 0 0 0
168 0 $self->is_role(1);
169 0 return $params[-2];
170 }
171 elsif ( $params[-1] =~ m/^(with|extends|parent|base)$/ ) {
172 0 ▶ return 'extends' if $1 =~ m/parent|base/;
Branch: 1 branch
BranchTrueFalseTotal
if $1 =~ /parent|base/ 0 0 0
173 0 return $params[-1];
174 }
175 ▶ elsif ( $params[-2] && $params[-2] =~ m/^(with|extends)$/ ) {
Condition0%0/3
$params[-2] and $params[-2] =~ /^(with|extends)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$params[-2] and $params[-2] =~ /^(with|extends)$/
$params[-2] $params[-2] =~ /^(with|extends)$/
Truth table0%0/3
A and B
A= $params[-2]B= $params[-2] =~ /^(with|extends)$/
ABresult
0X0
100
111
176 0 my ( $mg, $last, $ident ) = splice @params, -3;
177 0 $mg->$last($ident);
178 0 return $last;
179 }
180 0 my @res = $self->$orig(@params);
181 0 ▶ return wantarray ? @res : $res[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
182 }
183  
184 sub build_new {
185 6 ▶ my ( $self, $mg, $meta, $types ) = @_;
Subroutine build_new: called CC=14 SCAR=36.1
Pod documented
186 6 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 4 6
Condition100%2/2
ref $mg || ''
l!l
51
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
187 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
188 2 die
189 qq{Object: invalid value $mg for variable \$mg in method build_new};
190 }
191 4 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 2 4
Condition100%2/2
ref $meta || ''
l!l
31
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
192 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
193 2 die
194 qq{HashRef: invalid value $meta for variable \$meta in method build_new};
195 }
196 2 ▶ $types = defined $types ? $types : {};
Branch: 1 branch
BranchTrueFalseTotal
defined $types ? : 2 0 2
197 2 ▶ if ( ( ref($types) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $types || "") ne "HASH") 2 0 2
Condition100%2/2
ref $types || ''
l!l
11
MC/DC100%1/1
ref $types || ''
ref $types
Truth table100%2/2
A
A= ref $types
Aresult
11
00
198 2 ▶ $types = defined $types ? $types : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $types ? : 2 0 2
199 2 die
200 qq{HashRef: invalid value $types for variable \$types in method build_new};
201 }
202  
203 0 my %class = %Module::Generate::CLASS;
204 0 my %accessors = ();
205 map {
206 0 my $key = $_;
207 exists $meta->{$key}->{$_}
208 0 && do { $accessors{$key}->{$_} = $meta->{$key}->{$_} }
209 0 ▶ for ( @{ $self->build_has_keywords } );
Branch: 1 branch
BranchTrueFalseTotal
exists $meta->{$key}{$_} and do { $accessors{$key}{$_} = $meta->{$key}{$_} } 0 0 0
210 } grep {
211 $self->unique_types( $meta->{$_}->{type}, $types )
212 0 ▶ if $meta->{$_}->{type};
Branch: 1 branch
BranchTrueFalseTotal
if $meta->{$_}{"type"} 0 0 0
213 0 $meta->{$_}->{meta} eq 'ACCESSOR';
214 0 } keys %{$meta};
215 0 my $class_meta = $self->meta;
216 $class_meta->{ $class{CURRENT}{NAME} } = {
217 0 types => $types,
218 attributes => \%accessors
219 };
220 0 $self->meta($class_meta);
221 0 $self->current_class( $class{CURRENT}{NAME} );
222 0 $class{CURRENT}{SUBS}{new}{NO_CODE} = 1;
223 $class{CURRENT}{SUBS}{new}{TEST}
224 0 = [ $self->build_tests( 'new', $meta, 'new', \%class ) ];
225  
226 }
227  
228 sub build_clearer {
229 0 ▶ my ( $orig, $self, @params ) = ( 'SUPER::build_clearer', @_ );
Subroutine build_clearer: not called CC=2 SCAR=17.9
Pod documented
230 0 my @res = $self->$orig(@params);
231 0 $res[0]->no_code(1);
232  
233 0 ▶ return wantarray ? @res : $res[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
234 }
235  
236 sub build_predicate {
237 0 ▶ my ( $orig, $self, @params ) = ( 'SUPER::build_predicate', @_ );
Subroutine build_predicate: not called CC=2 SCAR=17.9
Pod documented
238 0 my @res = $self->$orig(@params);
239 0 $res[0]->no_code(1);
240  
241 0 ▶ return wantarray ? @res : $res[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
242 }
243  
244 sub build_accessor_no_arguments {
245 6 ▶ my ( $self, $mg, $token, $meta ) = @_;
Subroutine build_accessor_no_arguments: called CC=11 SCAR=25.3
Pod documented
246 6 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 4 6
Condition100%2/2
ref $mg || ''
l!l
51
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
247 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
248 2 die
249 qq{Object: invalid value $mg for variable \$mg in method build_accessor_no_arguments};
250 }
251 4 ▶ if ( !defined($token) || ( ref($token) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $token or (ref $token || "") ne "ARRAY") 2 2 4
Condition80%4/5
not defined $token or (ref $token || "") ne "ARRAY"
l!l&&r!l&&!r
022
ref $token || ''
l!l
31
MC/DC50%1/2
not defined $token or (ref $token || "") ne "ARRAY"
not defined $token ref $token
Truth table66%2/3
not(A) or B
A= not defined $tokenB= ref $token
ABresult
1X1
011
000
252 2 ▶ $token = defined $token ? $token : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $token ? : 2 0 2
253 2 die
254 qq{ArrayRef: invalid value $token for variable \$token in method build_accessor_no_arguments};
255 }
256 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
257 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
258 2 die
259 qq{HashRef: invalid value $meta for variable \$meta in method build_accessor_no_arguments};
260 }
261  
262 0 $meta->{ $token->[0] }->{meta} = 'ACCESSOR';
263 0 $mg->has( $token->[0] );
264 0 return $meta;
265  
266 }
267  
268 sub build_accessor {
269 6 ▶ my ( $self, $mg, $name, $meta ) = @_;
Subroutine build_accessor: called CC=17 SCAR=38.4
Pod documented
270 6 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 4 6
Condition100%2/2
ref $mg || ''
l!l
51
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
271 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
272 2 die
273 qq{Object: invalid value $mg for variable \$mg in method build_accessor};
274 }
275 4 ▶ if ( !defined($name) || ref $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $name or ref $name) 2 2 4
Condition66%2/3
not defined $name or ref $name
l!l&&r!l&&!r
022
MC/DC50%1/2
not defined $name or ref $name
not defined $name ref $name
Truth table66%2/3
not(A) or B
A= not defined $nameB= ref $name
ABresult
1X1
011
000
276 2 ▶ $name = defined $name ? $name : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
277 2 die
278 qq{Str: invalid value $name for variable \$name in method build_accessor};
279 }
280 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
281 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
282 2 die
283 qq{HashRef: invalid value $meta for variable \$meta in method build_accessor};
284 }
285  
286 0 $mg->has($name);
287 $meta->{$name}->{$_} and $mg->$_(
288 $self->build_code(
289 $mg,
290 $name,
291 $self->can("build_accessor_${_}")
292 ? $self->can("build_accessor_${_}")
293 ->( $self, $name, $meta->{$name}->{$_} )
294 : $meta->{$name}->{$_}
295 )
296 0 ▶ ) for ( @{ $self->build_has_keywords } );
Branch: 2 branches
BranchTrueFalseTotal
$meta->{$name}{$_} and $mg->$_($self->build_code($mg, $name, $self->can("build_accessor_$_") ? $self->can("build_accessor_$_")->($self, $name, $meta->{$name}{$_}) : $meta->{$name}{$_})) 0 0 0
$self->can("build_accessor_$_") ? : 0 0 0
297 $mg->isa(
298 $self->can("build_accessor_isa")
299 ? $self->can("build_accessor_isa")
300 ->( $self, $name, $meta->{$name}->{type}->[0] )
301 : $meta->{$name}->{type}->[0]
302 0 ▶ ) if !$meta->{$name}->{isa};
Branch: 2 branches
BranchTrueFalseTotal
unless $meta->{$name}{"isa"} 0 0 0
$self->can('build_accessor_isa') ? : 0 0 0
303 0 $mg->clear_tests->test( $self->build_tests( $name, $meta->{$name} ) );
304 $meta->{$name}->{$_}
305 && $mg->$_( $self->replace_pe_string( $meta->{$name}->{$_}, $name ) )
306 0 ▶ for qw/pod example/;
Branch: 1 branch
BranchTrueFalseTotal
$meta->{$name}{$_} and $mg->$_($self->replace_pe_string($meta->{$name}{$_}, $name)) 0 0 0
307  
308 }
309  
310 sub build_modify {
311 6 ▶ my ( $self, $mg, $name, $meta ) = @_;
Subroutine build_modify: called CC=14 SCAR=30.0
Pod documented
312 6 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 4 6
Condition100%2/2
ref $mg || ''
l!l
51
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
313 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
314 2 die
315 qq{Object: invalid value $mg for variable \$mg in method build_modify};
316 }
317 4 ▶ if ( !defined($name) || ref $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $name or ref $name) 2 2 4
Condition66%2/3
not defined $name or ref $name
l!l&&r!l&&!r
022
MC/DC50%1/2
not defined $name or ref $name
not defined $name ref $name
Truth table66%2/3
not(A) or B
A= not defined $nameB= ref $name
ABresult
1X1
011
000
318 2 ▶ $name = defined $name ? $name : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
319 2 die
320 qq{Str: invalid value $name for variable \$name in method build_modify};
321 }
322 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
323 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
324 2 die
325 qq{HashRef: invalid value $meta for variable \$meta in method build_modify};
326 }
327  
328 $meta->{$name}->{$_}
329 && $mg->$_($name)
330 ->code( $self->build_code( $mg, $name, delete $meta->{$name}->{$_} ) )
331 ->test( $self->build_tests( $name, $meta->{$name} ) )
332 0 ▶ for qw/before around after/;
Branch: 1 branch
BranchTrueFalseTotal
$meta->{$name}{$_} and $mg->$_($name)->code($self->build_code($mg, $name, delete $meta->{$name}{$_}))->test($self->build_tests($name, $meta->{$name})) 0 0 0
333 $meta->{$name}->{$_}
334 && $mg->$_(
335 $self->replace_pe_string( delete $meta->{$name}->{$_}, $name ) )
336 0 ▶ for qw/pod example/;
Branch: 1 branch
BranchTrueFalseTotal
$meta->{$name}{$_} and $mg->$_($self->replace_pe_string(delete $meta->{$name}{$_}, $name)) 0 0 0
337  
338 }
339  
340 sub after_class {
341 4 ▶ my ( $self, $mg, $meta ) = @_;
Subroutine after_class: called CC=9 SCAR=25.5
Pod documented
342 4 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 2 4
Condition100%2/2
ref $mg || ''
l!l
31
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
343 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
344 2 die
345 qq{Object: invalid value $mg for variable \$mg in method after_class};
346 }
347 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
348 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
349 2 die
350 qq{HashRef: invalid value $meta for variable \$meta in method after_class};
351 }
352  
353 0 ▶ $self->is_role && $self->clear_is_role
Branch: 1 branch
BranchTrueFalseTotal
$self->is_role && $self->clear_is_role ? : 0 0 0
Condition0%0/3
$self->is_role and $self->clear_is_role
!ll&&!rl&&r
000
MC/DC0%0/2
$self->is_role and $self->clear_is_role
$self->is_role $self->clear_is_role
Truth table0%0/3
A and B
A= $self->is_roleB= $self->clear_is_role
ABresult
0X0
100
111
354 ? $self->build_as_role( $mg, $meta )
355 : $self->build_as_class( $mg, $meta );
356  
357 }
358  
359 sub unique_types {
360 3 ▶ my ( $self, $type, $unique ) = @_;
Subroutine unique_types: called CC=19 SCAR=51.6
Pod documented
361 3 ▶ if ( ref $type eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $type eq "ARRAY") 0 3 3
362 0 $self->unique_types( $_, $unique ) for @{$type};
363 0 return;
364 }
365 3 ▶ if ( !defined($type) || ref $type ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $type or ref $type) 1 2 3
Condition66%2/3
not defined $type or ref $type
l!l&&r!l&&!r
012
MC/DC50%1/2
not defined $type or ref $type
not defined $type ref $type
Truth table66%2/3
not(A) or B
A= not defined $typeB= ref $type
ABresult
1X1
011
000
366 1 ▶ $type = defined $type ? $type : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $type ? : 1 0 1
367 1 die
368 qq{Str: invalid value $type for variable \$type in method unique_types};
369 }
370 2 ▶ if ( ( ref($unique) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $unique || "") ne "HASH") 2 0 2
Condition100%2/2
ref $unique || ''
l!l
11
MC/DC100%1/1
ref $unique || ''
ref $unique
Truth table100%2/2
A
A= ref $unique
Aresult
11
00
371 2 ▶ $unique = defined $unique ? $unique : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $unique ? : 2 0 2
372 2 die
373 qq{HashRef: invalid value $unique for variable \$unique in method unique_types};
374 }
375  
376 0 ▶ if ( $type =~ s/^([^\[ ]+)\[(.*)\]$/$2/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type =~ s/^([^\[ ]+)\[(.*)\]$/$2/) { } 0 0 0
elsif ($type =~ /^\s*\w+\s*\=\>\s*/ or $type =~ /^([^,]+),\s*(.*)$/) { } 0 0 0
377 0 my ( $t, $v ) = ( $1, $2 );
378 0 ▶ $unique->{$t}++ if ( $t =~ m/^\w+$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $t =~ /^\w+$/ 0 0 0
379 0 $v =~ s/,\s*\d+,\s*\d+$//g;
380 0 $self->unique_types( $v, $unique );
381 }
382 ▶ elsif ( $type =~ m/^\s*\w+\s*\=\>\s*/ || $type =~ m/^([^,]+),\s*(.*)$/ ) {
Condition0%0/3
$type =~ /^\s*\w+\s*\=\>\s*/ or $type =~ /^([^,]+),\s*(.*)$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$type =~ /^\s*\w+\s*\=\>\s*/ or $type =~ /^([^,]+),\s*(.*)$/
$type =~ /^\s*\w+\s*\=\>\s*/ $type =~ /^([^,]+),\s*(.*)$/
Truth table0%0/3
A or B
A= $type =~ /^\s*\w+\s*\=\>\s*/B= $type =~ /^([^,]+),\s*(.*)$/
ABresult
1X1
011
000
383 0 my @matches = split ',', $type;
384 0 ▶ while (@matches) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matches) 0 0 0
385 0 my ($match) = ( shift @matches );
386 0 ▶ if ( @matches && $match =~ m/(Map|Tuple|ArrayRef|Dict)\[/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matches and $match =~ /(Map|Tuple|ArrayRef|Dict)\[/) 0 0 0
Condition0%0/3
@matches and $match =~ /(Map|Tuple|ArrayRef|Dict)\[/
!ll&&!rl&&r
000
MC/DC0%0/2
@matches and $match =~ /(Map|Tuple|ArrayRef|Dict)\[/
@matches $match =~ /(Map|Tuple|ArrayRef|Dict)\[/
Truth table0%0/3
A and B
A= @matchesB= $match =~ /(Map|Tuple|ArrayRef|Dict)\[/
ABresult
0X0
100
111
387 my $cb = sub {
388 0 ▶ my $copy = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
389 0 ▶ 1 while ( $copy =~ s/\[[^\[\]]+\]//g );
Branch: 1 branch
BranchTrueFalseTotal
$copy =~ s/\[[^\[\]]+\]//g and do { '???' } 0 0 0
390 0 ▶ return ( $copy =~ m/\[|\]/ ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$copy =~ /\[|\]/ ? : 0 0 0
391 0 };
392 0 ▶ 1 while ( $cb->( $match .= ', ' . shift @matches ) );
Branch: 1 branch
BranchTrueFalseTotal
&$cb($match .= ', ' . shift(@matches)) and do { '???' } 0 0 0
393 }
394 my ( $k, $v )
395 0 ▶ = map { my $h = $_; $h =~ s/^\s*|\s*$//g; $h; }
Branch: 1 branch
BranchTrueFalseTotal
$match =~ /\s+\w*\s*\=\>/ ? : 0 0 0
396 $match =~ m/\s+\w*\s*\=\>/
397 ? split( '=>', $match, 2 )
398 : $match;
399 0 ▶ $self->unique_types( $v || $k, $unique );
Condition0%0/3
$v || $k
l!l&&r!l&&!r
000
MC/DC0%0/2
$v || $k
$v $k
Truth table0%0/3
A || B
A= $vB= $k
ABresult
1X1
011
000
400 }
401 }
402 else {
403 0 $unique->{$type}++;
404 }
405  
406 }
407  
408 sub build_as_class {
409 4 ▶ my ( $self, $mg, $meta ) = @_;
Subroutine build_as_class: called CC=7 SCAR=20.0
Pod documented
410 4 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 2 4
Condition100%2/2
ref $mg || ''
l!l
31
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
411 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
412 2 die
413 qq{Object: invalid value $mg for variable \$mg in method build_as_class};
414 }
415 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
416 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
417 2 die
418 qq{HashRef: invalid value $meta for variable \$meta in method build_as_class};
419 }
420 0 return ( $mg, $meta );
421 }
422  
423 sub build_as_role {
424 4 ▶ my ( $self, $mg, $meta ) = @_;
Subroutine build_as_role: called CC=7 SCAR=20.0
Pod documented
425 4 ▶ if ( ( ref($mg) || "" ) =~ m/^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $mg || "") =~ /^(|HASH|ARRAY|SCALAR|CODE|GLOB)$/) 2 2 4
Condition100%2/2
ref $mg || ''
l!l
31
MC/DC100%1/1
ref $mg || ''
ref $mg
Truth table100%2/2
A
A= ref $mg
Aresult
11
00
426 2 ▶ $mg = defined $mg ? $mg : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $mg ? : 2 0 2
427 2 die
428 qq{Object: invalid value $mg for variable \$mg in method build_as_role};
429 }
430 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
431 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
432 2 die
433 qq{HashRef: invalid value $meta for variable \$meta in method build_as_role};
434 }
435 0 return ( $mg, $meta );
436 }
437  
438 sub build_has_keywords {
439 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_has_keywords: called CC=6 SCAR=20.3
Pod documented
440 2 ▶ $keywords
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
441 = defined $keywords
442 ? $keywords
443 : [
444 qw/is isa required default clearer coerce predicate trigger private builder/
445 ];
446 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
447 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
448 2 die
449 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_has_keywords};
450 }
451 0 return $keywords;
452 }
453  
454 sub build_has {
455 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_has: called CC=4 SCAR=17.3
Pod documented
456 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
457 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
458 2 die
459 qq{HashRef: invalid value $meta for variable \$meta in method build_has};
460 }
461  
462 0 my $name = $meta->{has};
463 0 my $private = $self->SUPER::build_private( $name, $meta->{private} );
464 my $type = $self->SUPER::build_coerce( $name, '$value', $meta->{coerce} )
465 0 . $self->build_type( $name, $meta->{type}[0] );
466 my $trigger
467 0 = $self->SUPER::build_trigger( $name, '$value', $meta->{trigger} );
468 0 return qq|{
469 my ( \$self, \$value ) = \@_; $private
470 if ( defined \$value ) { $type
471 $self->{$name} = \$value; $trigger
472 }
473 return $self->{$name};
474 }|;
475  
476 }
477  
478 sub build_extends_keywords {
479 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_extends_keywords: called CC=6 SCAR=20.3
Pod documented
480 2 ▶ $keywords = defined $keywords ? $keywords : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
481 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
482 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
483 2 die
484 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_extends_keywords};
485 }
486 0 return $keywords;
487 }
488  
489 sub build_extends {
490 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_extends: called CC=5 SCAR=19.4
Pod documented
491 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
492 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
493 2 die
494 qq{HashRef: invalid value $meta for variable \$meta in method build_extends};
495 }
496  
497 $meta->{extends} = '"' . $meta->{extends} . '"'
498 0 ▶ if $meta->{extends} !~ m/^["'q]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"extends"} =~ /^["'q]/ 0 0 0
499 0 return qq(extends $meta->{extends};);
500  
501 }
502  
503 sub build_with_keywords {
504 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_with_keywords: called CC=6 SCAR=20.3
Pod documented
505 2 ▶ $keywords = defined $keywords ? $keywords : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
506 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
507 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
508 2 die
509 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_with_keywords};
510 }
511 0 return $keywords;
512 }
513  
514 sub build_with {
515 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_with: called CC=5 SCAR=19.4
Pod documented
516 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
517 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
518 2 die
519 qq{HashRef: invalid value $meta for variable \$meta in method build_with};
520 }
521  
522 0 ▶ $meta->{with} = '"' . $meta->{with} . '"' if $meta->{with} !~ m/^["'q]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"with"} =~ /^["'q]/ 0 0 0
523 0 return qq(with $meta->{with};);
524  
525 }
526  
527 sub build_requires_keywords {
528 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_requires_keywords: called CC=6 SCAR=20.3
Pod documented
529 2 ▶ $keywords = defined $keywords ? $keywords : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
530 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
531 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
532 2 die
533 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_requires_keywords};
534 }
535 0 return $keywords;
536 }
537  
538 sub build_requires {
539 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_requires: called CC=5 SCAR=19.4
Pod documented
540 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
541 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
542 2 die
543 qq{HashRef: invalid value $meta for variable \$meta in method build_requires};
544 }
545  
546 $meta->{requires} = '"' . $meta->{requires} . '"'
547 0 ▶ if $meta->{requires} !~ m/^["'q]/;
Branch: 1 branch
BranchTrueFalseTotal
unless $meta->{"requires"} =~ /^["'q]/ 0 0 0
548 0 return qq(requires $meta->{requires};);
549  
550 }
551  
552 sub build_before_keywords {
553 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_before_keywords: called CC=6 SCAR=20.3
Pod documented
554 2 ▶ $keywords = defined $keywords ? $keywords : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
555 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
556 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
557 2 die
558 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_before_keywords};
559 }
560 0 return $keywords;
561 }
562  
563 sub build_before {
564 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_before: called CC=4 SCAR=14.6
Pod documented
565 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
566 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
567 2 die
568 qq{HashRef: invalid value $meta for variable \$meta in method build_before};
569 }
570  
571 return
572 0 qq(before $meta->{before} => sub { my (\$orig, \$self, \@params) = \@_; $meta->{CODE} };);
573  
574 }
575  
576 sub build_around_keywords {
577 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_around_keywords: called CC=6 SCAR=20.3
Pod documented
578 2 ▶ $keywords = defined $keywords ? $keywords : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
579 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
580 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
581 2 die
582 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_around_keywords};
583 }
584 0 return $keywords;
585 }
586  
587 sub build_around {
588 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_around: called CC=4 SCAR=14.6
Pod documented
589 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
590 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
591 2 die
592 qq{HashRef: invalid value $meta for variable \$meta in method build_around};
593 }
594  
595 return
596 0 qq(around $meta->{around} => sub { my (\$orig, \$self, \@params) = \@_; $meta->{CODE} };);
597  
598 }
599  
600 sub build_after_keywords {
601 2 ▶ my ( $self, $keywords ) = @_;
Subroutine build_after_keywords: called CC=6 SCAR=20.3
Pod documented
602 2 ▶ $keywords = defined $keywords ? $keywords : [];
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
603 2 ▶ if ( !defined($keywords) || ( ref($keywords) || "" ) ne "ARRAY" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $keywords or (ref $keywords || "") ne "ARRAY") 2 0 2
Condition60%3/5
not defined $keywords or (ref $keywords || "") ne "ARRAY"
l!l&&r!l&&!r
020
ref $keywords || ''
l!l
11
MC/DC50%1/2
not defined $keywords or (ref $keywords || "") ne "ARRAY"
not defined $keywords ref $keywords
Truth table66%2/3
not(A) or B
A= not defined $keywordsB= ref $keywords
ABresult
1X1
011
000
604 2 ▶ $keywords = defined $keywords ? $keywords : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $keywords ? : 2 0 2
605 2 die
606 qq{ArrayRef: invalid value $keywords for variable \$keywords in method build_after_keywords};
607 }
608 0 return $keywords;
609 }
610  
611 sub build_after {
612 2 ▶ my ( $self, $meta ) = @_;
Subroutine build_after: called CC=4 SCAR=14.6
Pod documented
613 2 ▶ if ( ( ref($meta) || "" ) ne "HASH" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((ref $meta || "") ne "HASH") 2 0 2
Condition100%2/2
ref $meta || ''
l!l
11
MC/DC100%1/1
ref $meta || ''
ref $meta
Truth table100%2/2
A
A= ref $meta
Aresult
11
00
614 2 ▶ $meta = defined $meta ? $meta : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $meta ? : 2 0 2
615 2 die
616 qq{HashRef: invalid value $meta for variable \$meta in method build_after};
617 }
618  
619 return
620 0 qq(after $meta->{after} => sub { my (\$orig, \@params) = \@_; $meta->{CODE} };);
621  
622 }
623  
624 sub build_accessor_builder {
625 4 ▶ my ( $self, $name, $content ) = @_;
Subroutine build_accessor_builder: called CC=8 SCAR=24.3
Pod documented
626 4 ▶ if ( !defined($name) || ref $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $name or ref $name) 2 2 4
Condition66%2/3
not defined $name or ref $name
l!l&&r!l&&!r
022
MC/DC50%1/2
not defined $name or ref $name
not defined $name ref $name
Truth table66%2/3
not(A) or B
A= not defined $nameB= ref $name
ABresult
1X1
011
000
627 2 ▶ $name = defined $name ? $name : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
628 2 die
629 qq{Str: invalid value $name for variable \$name in method build_accessor_builder};
630 }
631 2 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 0 2
Condition33%1/3
not defined $content or ref $content
l!l&&r!l&&!r
020
MC/DC0%0/2
not defined $content or ref $content
not defined $content ref $content
Truth table33%1/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
632 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
633 2 die
634 qq{Str: invalid value $content for variable \$content in method build_accessor_builder};
635 }
636  
637 return (
638 0 ▶ $content =~ m/^(\w+|1)$/
Branch: 1 branch
BranchTrueFalseTotal
$content =~ /^(\w+|1)$/ ? : 0 0 0
639 ? qq|$content|
640 : qq|sub {
641 my (\$self, \$value) = \@_;
642 $content
643 return \$value;
644 }|
645 );
646  
647 }
648  
649 sub build_accessor_coerce {
650 4 ▶ my ( $self, $name, $content ) = @_;
Subroutine build_accessor_coerce: called CC=8 SCAR=24.3
Pod documented
651 4 ▶ if ( !defined($name) || ref $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $name or ref $name) 2 2 4
Condition66%2/3
not defined $name or ref $name
l!l&&r!l&&!r
022
MC/DC50%1/2
not defined $name or ref $name
not defined $name ref $name
Truth table66%2/3
not(A) or B
A= not defined $nameB= ref $name
ABresult
1X1
011
000
652 2 ▶ $name = defined $name ? $name : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
653 2 die
654 qq{Str: invalid value $name for variable \$name in method build_accessor_coerce};
655 }
656 2 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 0 2
Condition33%1/3
not defined $content or ref $content
l!l&&r!l&&!r
020
MC/DC0%0/2
not defined $content or ref $content
not defined $content ref $content
Truth table33%1/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
657 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
658 2 die
659 qq{Str: invalid value $content for variable \$content in method build_accessor_coerce};
660 }
661  
662 0 ▶ return q|sub { my ($value) = @_;|
Branch: 1 branch
BranchTrueFalseTotal
$content =~ /^\w+$/ ? : 0 0 0
663 . (
664 $content =~ m/^\w+$/
665 ? qq|\$value = __PACKAGE__->$content(\$value);|
666 : $content
667 ) . q|return $value; }|;
668  
669 }
670  
671 sub build_accessor_trigger {
672 4 ▶ my ( $self, $name, $content ) = @_;
Subroutine build_accessor_trigger: called CC=8 SCAR=24.3
Pod documented
673 4 ▶ if ( !defined($name) || ref $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $name or ref $name) 2 2 4
Condition66%2/3
not defined $name or ref $name
l!l&&r!l&&!r
022
MC/DC50%1/2
not defined $name or ref $name
not defined $name ref $name
Truth table66%2/3
not(A) or B
A= not defined $nameB= ref $name
ABresult
1X1
011
000
674 2 ▶ $name = defined $name ? $name : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
675 2 die
676 qq{Str: invalid value $name for variable \$name in method build_accessor_trigger};
677 }
678 2 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 0 2
Condition33%1/3
not defined $content or ref $content
l!l&&r!l&&!r
020
MC/DC0%0/2
not defined $content or ref $content
not defined $content ref $content
Truth table33%1/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
679 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
680 2 die
681 qq{Str: invalid value $content for variable \$content in method build_accessor_trigger};
682 }
683  
684 0 ▶ return q|sub { my ($self, $value) = @_;|
Branch: 1 branch
BranchTrueFalseTotal
$content =~ /^\w+$/ ? : 0 0 0
685 . (
686 $content =~ m/^\w+$/
687 ? qq|\$value = \$self->$content(\$value);|
688 : $content
689 ) . q|return $value; }|;
690  
691 }
692  
693 sub build_accessor_default {
694 4 ▶ my ( $self, $name, $content ) = @_;
Subroutine build_accessor_default: called CC=7 SCAR=21.5
Pod documented
695 4 ▶ if ( !defined($name) || ref $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $name or ref $name) 2 2 4
Condition66%2/3
not defined $name or ref $name
l!l&&r!l&&!r
022
MC/DC50%1/2
not defined $name or ref $name
not defined $name ref $name
Truth table66%2/3
not(A) or B
A= not defined $nameB= ref $name
ABresult
1X1
011
000
696 2 ▶ $name = defined $name ? $name : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 2 0 2
697 2 die
698 qq{Str: invalid value $name for variable \$name in method build_accessor_default};
699 }
700 2 ▶ if ( !defined($content) || ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content or ref $content) 2 0 2
Condition33%1/3
not defined $content or ref $content
l!l&&r!l&&!r
020
MC/DC0%0/2
not defined $content or ref $content
not defined $content ref $content
Truth table33%1/3
not(A) or B
A= not defined $contentB= ref $content
ABresult
1X1
011
000
701 2 ▶ $content = defined $content ? $content : 'undef';
Branch: 1 branch
BranchTrueFalseTotal
defined $content ? : 2 0 2
702 2 die
703 qq{Str: invalid value $content for variable \$content in method build_accessor_default};
704 }
705  
706 0 return q|sub {| . $content . q|}|;
707  
708 }
709  
710 2 1;
711  
712 __END__
713  
714 =head1 NAME
715  
716 Hades::Realm::OO - Hades realm for object orientation
717  
718 =head1 VERSION
719  
720 Version 0.01
721  
722 =cut
723  
724 =head1 SYNOPSIS
725  
726 Quick summary of what the module does:
727  
728 Hades::Realm::Kosmos base Hades::Realm::OO {
729 ...
730 }
731  
732 =head1 SUBROUTINES/METHODS
733  
734 =head2 new
735  
736 Instantiate a new Hades::Realm::OO object.
737  
738 Hades::Realm::OO->new
739  
740 =head2 clear_is_role
741  
742 clear is_role accessor
743  
744 $obj->clear_is_role
745  
746 =head2 module_generate
747  
748 call module_generate method. Expects param $mg to be a Object.
749  
750 $obj->module_generate($mg)
751  
752 =head2 build_class_inheritance
753  
754 call build_class_inheritance method.
755  
756 =head2 build_new
757  
758 call build_new method. Expects param $mg to be a Object, param $meta to be a HashRef, param $types to be a HashRef.
759  
760 $obj->build_new($mg, $meta, $types)
761  
762 =head2 build_clearer
763  
764 call build_clearer method.
765  
766 =head2 build_predicate
767  
768 call build_predicate method.
769  
770 =head2 build_accessor_no_arguments
771  
772 call build_accessor_no_arguments method. Expects param $mg to be a Object, param $token to be a ArrayRef, param $meta to be a HashRef.
773  
774 $obj->build_accessor_no_arguments($mg, $token, $meta)
775  
776 =head2 build_accessor
777  
778 call build_accessor method. Expects param $mg to be a Object, param $name to be a Str, param $meta to be a HashRef.
779  
780 $obj->build_accessor($mg, $name, $meta)
781  
782 =head2 build_modify
783  
784 call build_modify method. Expects param $mg to be a Object, param $name to be a Str, param $meta to be a HashRef.
785  
786 $obj->build_modify($mg, $name, $meta)
787  
788 =head2 after_class
789  
790 call after_class method. Expects param $mg to be a Object, param $meta to be a HashRef.
791  
792 $obj->after_class($mg, $meta)
793  
794 =head2 unique_types
795  
796 call unique_types method. Expects param $type to be a Str, param $unique to be a HashRef.
797  
798 $obj->unique_types($type, $unique)
799  
800 =head2 build_as_class
801  
802 call build_as_class method. Expects param $mg to be a Object, param $meta to be a HashRef.
803  
804 $obj->build_as_class($mg, $meta)
805  
806 =head2 build_as_role
807  
808 call build_as_role method. Expects param $mg to be a Object, param $meta to be a HashRef.
809  
810 $obj->build_as_role($mg, $meta)
811  
812 =head2 build_has_keywords
813  
814 call build_has_keywords method. Expects param $keywords to be a ArrayRef.
815  
816 $obj->build_has_keywords($keywords)
817  
818 =head2 build_has
819  
820 call build_has method. Expects param $meta to be a HashRef.
821  
822 $obj->build_has($meta)
823  
824 =head2 build_extends_keywords
825  
826 call build_extends_keywords method. Expects param $keywords to be a ArrayRef.
827  
828 $obj->build_extends_keywords($keywords)
829  
830 =head2 build_extends
831  
832 call build_extends method. Expects param $meta to be a HashRef.
833  
834 $obj->build_extends($meta)
835  
836 =head2 build_with_keywords
837  
838 call build_with_keywords method. Expects param $keywords to be a ArrayRef.
839  
840 $obj->build_with_keywords($keywords)
841  
842 =head2 build_with
843  
844 call build_with method. Expects param $meta to be a HashRef.
845  
846 $obj->build_with($meta)
847  
848 =head2 build_requires_keywords
849  
850 call build_requires_keywords method. Expects param $keywords to be a ArrayRef.
851  
852 $obj->build_requires_keywords($keywords)
853  
854 =head2 build_requires
855  
856 call build_requires method. Expects param $meta to be a HashRef.
857  
858 $obj->build_requires($meta)
859  
860 =head2 build_before_keywords
861  
862 call build_before_keywords method. Expects param $keywords to be a ArrayRef.
863  
864 $obj->build_before_keywords($keywords)
865  
866 =head2 build_before
867  
868 call build_before method. Expects param $meta to be a HashRef.
869  
870 $obj->build_before($meta)
871  
872 =head2 build_around_keywords
873  
874 call build_around_keywords method. Expects param $keywords to be a ArrayRef.
875  
876 $obj->build_around_keywords($keywords)
877  
878 =head2 build_around
879  
880 call build_around method. Expects param $meta to be a HashRef.
881  
882 $obj->build_around($meta)
883  
884 =head2 build_after_keywords
885  
886 call build_after_keywords method. Expects param $keywords to be a ArrayRef.
887  
888 $obj->build_after_keywords($keywords)
889  
890 =head2 build_after
891  
892 call build_after method. Expects param $meta to be a HashRef.
893  
894 $obj->build_after($meta)
895  
896 =head2 build_accessor_builder
897  
898 call build_accessor_builder method. Expects param $name to be a Str, param $content to be a Str.
899  
900 $obj->build_accessor_builder($name, $content)
901  
902 =head2 build_accessor_coerce
903  
904 call build_accessor_coerce method. Expects param $name to be a Str, param $content to be a Str.
905  
906 $obj->build_accessor_coerce($name, $content)
907  
908 =head2 build_accessor_trigger
909  
910 call build_accessor_trigger method. Expects param $name to be a Str, param $content to be a Str.
911  
912 $obj->build_accessor_trigger($name, $content)
913  
914 =head2 build_accessor_default
915  
916 call build_accessor_default method. Expects param $name to be a Str, param $content to be a Str.
917  
918 $obj->build_accessor_default($name, $content)
919  
920 =head1 ACCESSORS
921  
922 =head2 current_class
923  
924 get or set current_class.
925  
926 $obj->current_class;
927  
928 $obj->current_class($value);
929  
930 =head2 meta
931  
932 get or set meta.
933  
934 $obj->meta;
935  
936 $obj->meta($value);
937  
938 =head2 is_role
939  
940 get or set is_role.
941  
942 $obj->is_role;
943  
944 $obj->is_role($value);
945  
946 =head1 AUTHOR
947  
948 LNATION, C<< <email at lnation.org> >>
949  
950 =head1 BUGS
951  
952 Please report any bugs or feature requests to C<bug-hades::realm::oo at rt.cpan.org>, or through
953 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Realm-OO>. I will be notified, and then you'll
954 automatically be notified of progress on your bug as I make changes.
955  
956 =head1 SUPPORT
957  
958 You can find documentation for this module with the perldoc command.
959  
960 perldoc Hades::Realm::OO
961  
962 You can also look for information at:
963  
964 =over 4
965  
966 =item * RT: CPAN's request tracker (report bugs here)
967  
968 L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Hades-Realm-OO>
969  
970 =item * AnnoCPAN: Annotated CPAN documentation
971  
972 L<http://annocpan.org/dist/Hades-Realm-OO>
973  
974 =item * CPAN Ratings
975  
976 L<https://cpanratings.perl.org/d/Hades-Realm-OO>
977  
978 =item * Search CPAN
979  
980 L<https://metacpan.org/release/Hades-Realm-OO>
981  
982 =back
983  
984 =head1 ACKNOWLEDGEMENTS
985  
986 =head1 LICENSE AND COPYRIGHT
987  
988 This software is Copyright (c) 2020 by LNATION.
989  
990 This is free software, licensed under:
991  
992 The Artistic License 2.0 (GPL Compatible)
993  
994 =cut
995  
996
↑ Summary