blib/lib/Aion.pm

filter: Statementstmt 82.0% 766 / 934 Branchbran 56.7% 193 / 340 Conditioncond 39.5% 57 / 144 MC/DCmcdc 3.3% 3 / 89 Subroutinesub 99.2% 134 / 135 Podpod 41.3% 12 / 29 totaltotal 69.7% 1165 / 1671 CC 226 SCAR 19.7
CC
226
Cov
72%
inherits
20.8
unimport
20.0
initialize
14.6
CRAP 7.2
« blib/lib/Aion/Type/DNF.pm ↑ Summary blib/lib/Aion/Pleroma.pm »
1 package Aion;
2  
3 5 ▶use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = "2.5";
6  
7 5 ▶use Aion::Types qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Aion::Meta::RequiresAnyFunction;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Aion::Meta::Feature;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Aion::Meta::RequiresFeature;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use Aion::Meta::Subroutine;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # Когда осуществлять проверки:
14 # ro - только при выдаче
15 # wo - только при установке
16 # rw - при выдаче и уcтановке
17 # no - никогда не проверять
18 5 ▶use Aion::Env AION_ISA => (default => 'rw');
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 sub export($@);
21 sub extends(@);
22 sub inherits($$@);
23 sub with(@);
24  
25 # Классы в которых подключён Aion с метаинформацией
26 1 our %META;
27  
28 1 my @EXPORT_BASE = qw/with has aspect does exactly have havelock/;
29 1 my @EXPORT_IN_CLASS = qw/extends/;
30 1 my @EXPORT_IN_ROLE = qw/requires req/;
31  
32 # Вызывается из другого пакета, для импорта данного
33 74 ▶sub import {
Subroutine import: called CC=13 SCAR=25.7
34 74 my (undef, @attrs) = @_;
35 74 my $pkg = caller;
36  
37 74 ▶ *{"$pkg\::DOES"} = \&does if \&does != $pkg->can('DOES');
Branch: 1 branch
BranchTrueFalseTotal
if \&Aion::does != $pkg->can("DOES") 72 2 74
38  
39 74 my $is_role; my @type_attrs;
40 74 my @with; my @extends;
41 74 my @export; my $use_only;
42 74 ▶ while(local $_ = shift @attrs) {
Branch: 1 branch
BranchTrueFalseTotal
if (local $_ = shift @attrs) 21 74 95
43 21 given($_) {
44 21 $is_role = 1 when '-role';
45 5 $use_only = 1 when '-use_only';
46 4 ▶ push @export, ref($_ = shift @attrs)? @$_: $_ when '-export';
Branch: 1 branch
BranchTrueFalseTotal
ref($_ = shift @attrs) ? : 1 0 1
47 3 ▶ push @with, ref($_ = shift @attrs)? @$_: $_ when 'with';
Branch: 1 branch
BranchTrueFalseTotal
ref($_ = shift @attrs) ? : 1 2 3
48 0 ▶ push @extends, ref($_ = shift @attrs)? @$_: $_ when 'extends';
Branch: 1 branch
BranchTrueFalseTotal
ref($_ = shift @attrs) ? : 0 0 0
49 0 default { push @type_attrs, $_ }
50 }
51 }
52  
53 # Метаинформация
54 74 ▶ $META{$pkg} = {
Condition100%3/3
$use_only || !!@export
l!l&&r!l&&!r
1172
MC/DC100%2/2
$use_only || !!@export
$use_only !!@export
Truth table100%3/3
A || B
A= $use_onlyB= !!@export
ABresult
1X1
011
000
55 order => scalar keys %META,
56 is_role => $is_role,
57 with => [],
58 extends => [],
59 export => \@export,
60 use_only => ($use_only || !!@export),
61 require => {},
62 feature => {},
63 subroutine => {},
64 havelock => {},
65 aspect => {
66 is => \&is_aspect,
67 isa => \&isa_aspect,
68 coerce => \&coerce_aspect,
69 lazy => \&lazy_aspect,
70 default => \&default_aspect,
71 trigger => \&trigger_aspect,
72 release => \&release_aspect,
73 init_arg => \&init_arg_aspect,
74 accessor => \&accessor_aspect,
75 writer => \&writer_aspect,
76 reader => \&reader_aspect,
77 predicate => \&predicate_aspect,
78 clearer => \&clearer_aspect,
79 cleaner => \&cleaner_aspect,
80 eon => \&eon_aspect,
81 }
82 };
83  
84 74 ▶ if(@extends) {
Branch: 1 branch
BranchTrueFalseTotal
if (@extends) 0 74 74
85 0 ▶ die "Extends role!" if $is_role;
Branch: 1 branch
BranchTrueFalseTotal
if $is_role 0 0 0
86 0 inherits $pkg, 0, @extends;
87 }
88  
89 74 ▶ if(@with) {
Branch: 1 branch
BranchTrueFalseTotal
if (@with) 2 72 74
90 2 inherits $pkg, 1, @with;
91 }
92  
93 74 ▶ unless($is_role) { # Класс
Branch: 1 branch
BranchTrueFalseTotal
if ($is_role) { } 16 58 74
94 58 export $pkg, @EXPORT_IN_CLASS;
95 58 *{"${pkg}::new"} = \&initialize;
96 } else { # Роль
97 16 export $pkg, @EXPORT_IN_ROLE;
98 }
99  
100 74 export $pkg, @EXPORT_BASE;
101
102 0 ▶ my $attrs = @type_attrs? "qw{${\join ' ', @type_attrs}}": '';
Branch: 1 branch
BranchTrueFalseTotal
@type_attrs ? : 0 74 74
103 5 ▶ eval "package $pkg; use Aion::Types@type_attrs; 1" or die;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
eval "package $pkg; use Aion::Types@type_attrs; 1" or die 74 0 74
104 }
105  
106 # Удаляет добавленные символы
107 0 ▶sub unimport {
Subroutine unimport: not called CC=4 SCAR=30.0
108 0 my $pkg = caller;
109  
110 0 my $meta = $META{$pkg};
111
112 0 ▶ undef &{"${pkg}::$_"} for @EXPORT_BASE,
Branch: 1 branch
BranchTrueFalseTotal
$meta->{'is_role'} ? : 0 0 0
113 $meta->{is_role}? @EXPORT_IN_ROLE: (@EXPORT_IN_CLASS, 'new');
114  
115 0 ▶ eval "package $pkg; no Aion::Types; 1" or die;
Branch: 1 branch
BranchTrueFalseTotal
eval "package $pkg; no Aion::Types; 1" or die 0 0 0
116 }
117  
118 # Экспортирует функции в пакет, если их там ещё нет
119 148 ▶sub export($@) {
Subroutine export: called CC=5 SCAR=16.3
Pod undocumented
120 148 my $pkg = shift;
121 148 for my $sub (@_) {
122 608 my $can = $pkg->can($sub);
123 608 ▶ die "$pkg can $sub!" if $can && $can != \&$sub;
Branch: 1 branch
BranchTrueFalseTotal
if $can and $can != \&$sub 0 608 608
Condition66%2/3
$can and $can != \&$sub
!ll&&!rl&&r
577310
MC/DC0%0/2
$can and $can != \&$sub
$can $can != \&$sub
Truth table66%2/3
A and B
A= $canB= $can != \&$sub
ABresult
0X0
100
111
124 608 ▶ *{"${pkg}::$sub"} = \&$sub unless $can;
Branch: 1 branch
BranchTrueFalseTotal
unless $can 577 31 608
125 }
126 }
127  
128 # Проверяет, что этот пакет инициализирован Aion
129 128 ▶sub is_aion($) {
Subroutine is_aion: called CC=2 SCAR=7.2
Pod undocumented
130 128 my $pkg = shift;
131 128 ▶ die "$pkg is'nt class of Aion!" if !exists $META{$pkg};
Branch: 1 branch
BranchTrueFalseTotal
if not exists $Aion::META{$pkg} 0 128 128
132 }
133  
134 #@category Aspects
135  
136 # ro, rw, + и -, *
137 41 ▶sub is_aspect {
Subroutine is_aspect: called CC=9 SCAR=22.0
Pod undocumented
138 41 my ($is, $feature) = @_;
139 41 ▶ die "Use is => '{ro|rw|wo|no} {+|-} {*} {?} {!}'" if $is !~ /^(?<access>ro|rw|wo|no)?(?<require>[+-])?(?<weak>\*)?(?<has>\??)(?<clear>!?)\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $is =~ /^(?<access>ro|rw|wo|no)?(?<require>[+-])?(?<weak>\*)?(?<has>\??)(?<clear>!?)\z/u 0 41 41
140  
141 41 my ($construct, $name) = @$feature{qw/construct name/};
142  
143 41 ▶ $construct->getter("die 'Feature $name cannot be get!';") if $+{access} ~~ [qw/wo no/];
Branch: 1 branch
BranchTrueFalseTotal
if $+{"access"} ~~ ["wo", "no"] 2 39 41
144  
145 41 ▶ $construct->setter("die 'Feature $name cannot be set!';") if $+{access} ~~ [qw/ro no/];
Branch: 1 branch
BranchTrueFalseTotal
if $+{"access"} ~~ ["ro", "no"] 27 14 41
146  
147 41 ▶ $construct->add_trigger("%(weaken)s") if $+{weak};
Branch: 1 branch
BranchTrueFalseTotal
if $+{"weak"} 1 40 41
148  
149 41 ▶ $feature->{required} = 1, $construct->not_specified(' else { die "%(init_arg)s required!" }') if $+{require} eq '+';
Branch: 1 branch
BranchTrueFalseTotal
if $+{"require"} eq "+" 6 35 41
150
151 41 ▶ $feature->{excessive} = 1, $construct->initer('die "%(init_arg)s excessive!"') if $+{require} eq '-';
Branch: 1 branch
BranchTrueFalseTotal
if $+{"require"} eq "-" 3 38 41
152  
153 41 ▶ $feature->{make_predicate} = 1 if $+{has};
Branch: 1 branch
BranchTrueFalseTotal
if $+{"has"} 7 34 41
154 41 ▶ $feature->{make_clearer} = 1 if $+{clear};
Branch: 1 branch
BranchTrueFalseTotal
if $+{"clear"} 4 37 41
155 }
156  
157 # isa => Type
158 28 ▶sub isa_aspect {
Subroutine isa_aspect: called CC=3 SCAR=11.2
Pod undocumented
159 28 my ($isa, $feature) = @_;
160 28 my ($construct, $name) = @$feature{qw/construct name/};
161  
162 28 $feature->{isa} = Aion::Types::External[$isa];
163  
164 28 ▶ $construct->add_release("${\$feature->meta}\{isa}->validate(\$val, 'Get feature $name');") if AION_ISA =~ /ro|rw/;
Branch: 1 branch
BranchTrueFalseTotal
if "rw" =~ /ro|rw/u 28 0 28
165  
166 28 ▶ $construct->add_preset("${\$feature->meta}\{isa}->validate(\$val, 'Set feature $name');") if AION_ISA =~ /wo|rw/;
Branch: 1 branch
BranchTrueFalseTotal
if "rw" =~ /wo|rw/u 28 0 28
167 }
168  
169 # coerce => 1
170 4 ▶sub coerce_aspect {
Subroutine coerce_aspect: called CC=4 SCAR=14.6
Pod undocumented
171 4 my ($coerce, $feature) = @_;
172  
173 4 ▶ return unless $coerce;
Branch: 1 branch
BranchTrueFalseTotal
unless $coerce 0 4 4
174  
175 4 ▶ die "coerce: isa not present!" unless $feature->{isa};
Branch: 1 branch
BranchTrueFalseTotal
unless $feature->{"isa"} 0 4 4
176  
177 4 ▶ $feature->{construct}->add_preset("\$val = ${\$feature->meta}\{isa}->coerce(\$val);", 1) if AION_ISA =~ /wo|rw/;
Branch: 1 branch
BranchTrueFalseTotal
if "rw" =~ /wo|rw/u 4 0 4
178 }
179  
180 1 my $pleroma;
181  
182 1 ▶sub pleroma {
Subroutine pleroma: called CC=1 SCAR=0.0
183 1 require Aion::Pleroma;
184 1 $pleroma = Aion::Pleroma->new;
185 1 ▶ *pleroma = sub { $pleroma };
Subroutine __ANON__: called CC=1 SCAR=0.0
186 1 $pleroma
187 }
188  
189 # eon => $key
190 3 ▶sub eon_aspect {
Subroutine eon_aspect: called CC=10 SCAR=26.7
Pod documented
191 3 my ($key, $feature) = @_;
192  
193 3 ▶ die "eon is not compatible with default!" if $feature->{opt}{default};
Branch: 1 branch
BranchTrueFalseTotal
if $feature->{"opt"}{"default"} 0 3 3
194  
195 3 ▶ if($key eq 1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($key eq 1) { } 1 2 3
elsif ($key eq 2) { } 1 1 2
196 1 my $isa = $feature->{isa};
197 1 ▶ $key = $isa && $isa->{name} eq "Object" && $isa->{args}[0]
Branch: 1 branch
BranchTrueFalseTotal
$key = $isa && $isa->{"name"} eq "Object" && $isa->{"args"}[0] or die qq[use: has $feature->{"name"} => (isa => Object[...], eon => 1)] 1 0 1
Condition33%2/6
$isa && $isa->{'name'} eq 'Object' && $isa->{'args'}[0]
!ll&&!rl&&r
001
$isa and $isa->{"name"} eq "Object"
!ll&&!rl&&r
001
MC/DC0%0/3
$isa && $isa->{'name'} eq 'Object' && $isa->{'args'}[0]
$isa $isa->{"name"} eq "Object" $isa->{'args'}[0]
Truth table25%1/4
A and B && C
A= $isaB= $isa->{"name"} eq "Object"C= $isa->{'args'}[0]
ABCresult
0XX0
10X0
1100
1111
198 or die "use: has $feature->{name} => (isa => Object[...], eon => 1)";
199 }
200 elsif($key eq 2) {
201 1 my $isa = $feature->{isa};
202 1 ▶ $key = ($isa && $isa->{name} eq "Object" && $isa->{args}[0]
Condition37%3/8
$isa && $isa->{'name'} eq 'Object' && $isa->{'args'}[0] || die("use: has $feature->{'name'} => (isa => Object[...], eon => 2)")
l!l
10
$isa and $isa->{"name"} eq "Object" and $isa->{"args"}[0]
!ll&&!rl&&r
001
$isa and $isa->{"name"} eq "Object"
!ll&&!rl&&r
001
MC/DC0%0/3
$isa && $isa->{'name'} eq 'Object' && $isa->{'args'}[0] || die("use: has $feature->{'name'} => (isa => Object[...], eon => 2)")
$isa $isa->{"name"} eq "Object" $isa->{"args"}[0]
Truth table25%1/4
A and B and C
A= $isaB= $isa->{"name"} eq "Object"C= $isa->{"args"}[0]
ABCresult
1111
0XX0
10X0
1100
203 or die "use: has $feature->{name} => (isa => Object[...], eon => 2)")
204 . "#$feature->{name}";
205
206 }
207  
208 3 ▶ default_aspect(sub { Aion->pleroma->resolve($key) }, $feature);
Subroutine __ANON__: called CC=1 SCAR=0.0
209 }
210  
211 # lazy => 1|0
212 4 ▶sub lazy_aspect {
Subroutine lazy_aspect: called CC=1 SCAR=0.0
Pod undocumented
213 4 my ($lazy, $feature) = @_;
214  
215 4 $feature->{lazy} = $lazy;
216 }
217  
218 # default => value
219 19 ▶sub default_aspect {
Subroutine default_aspect: called CC=7 SCAR=19.5
Pod undocumented
220 19 my ($default, $feature) = @_;
221  
222 19 my $name = $feature->name;
223 19 my $default_is_code = ref $default eq "CODE";
224  
225 19 ▶ if($default_is_code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($default_is_code) { } 9 10 19
226 9 $feature->{builder} = $default;
227 } else {
228 10 $feature->{default} = $default;
229 10 ▶ $feature->{isa}->validate($default, $name) if $feature->{isa};
Branch: 1 branch
BranchTrueFalseTotal
if $feature->{"isa"} 6 4 10
230 }
231  
232 19 ▶ if($feature->{opt}{lazy} // $default_is_code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($feature->{'opt'}{'lazy'} // $default_is_code) { } 7 12 19
Condition66%2/3
$feature->{"opt"}{"lazy"} // $default_is_code
l!l&&r!l&&!r
4150
MC/DC0%0/2
$feature->{"opt"}{"lazy"} // $default_is_code
$feature->{"opt"}{"lazy"} $default_is_code
Truth table66%2/3
A // B
A= $feature->{"opt"}{"lazy"}B= $default_is_code
ABresult
1X1
011
000
233 7 $feature->{lazy} = 1;
234  
235 7 ▶ if ($default_is_code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($default_is_code) { } 6 1 7
236 6 $feature->construct->add_access("unless(%(has)s) {
237 6 my \$val = ${\$feature->meta}\{builder}->(\$self);
238 %(write)s
239 }");
240 } else {
241 1 $feature->construct->add_access("unless(%(has)s) {
242 1 my \$val = ${\$feature->meta}\{default};
243 %(write)s
244 }");
245 }
246 } else {
247 12 ▶ if($default_is_code) {
Branch: 1 branch
BranchTrueFalseTotal
if ($default_is_code) { } 3 9 12
248 3 $feature->{construct}->not_specified(" else {
249 3 my \$val = ${\$feature->meta}\{builder}->(\$self);
250 %(write)s
251 }");
252 } else {
253 9 $feature->{construct}->not_specified(" else {
254 9 my \$val = ${\$feature->meta}\{default};
255 %(write)s
256 }");
257 }
258
259 }
260 }
261  
262 # trigger => $sub
263 1 ▶sub trigger_aspect {
Subroutine trigger_aspect: called CC=1 SCAR=0.0
Pod undocumented
264 1 my ($trigger, $feature) = @_;
265  
266 1 $feature->{trigger} = $trigger;
267  
268 1 my $construct = $feature->{construct};
269  
270 1 $construct->add_preset("my \@old = %(has)s? %(get)s: ();");
271 1 $construct->add_trigger("${\$feature->meta}\{trigger}->(\$self, \@old);");
272 }
273  
274 # release => $sub
275 1 ▶sub release_aspect {
Subroutine release_aspect: called CC=1 SCAR=0.0
Pod undocumented
276 1 my ($release, $feature) = @_;
277  
278 1 $feature->{release} = $release;
279  
280 1 $feature->{construct}->add_release("${\$feature->meta}\{release}->(\$self, \$val);");
281 }
282  
283 # init_arg => $name
284 1 ▶sub init_arg_aspect {
Subroutine init_arg_aspect: called CC=1 SCAR=0.0
Pod undocumented
285 1 my ($init_arg, $feature) = @_;
286  
287 1 $feature->construct->init_arg($init_arg);
288 }
289  
290 # accessor => $name
291 1 ▶sub accessor_aspect {
Subroutine accessor_aspect: called CC=1 SCAR=0.0
Pod undocumented
292 1 my ($accessor, $feature) = @_;
293  
294 1 $feature->construct->accessor_name($accessor);
295 }
296  
297 # writer => $name
298 1 ▶sub writer_aspect {
Subroutine writer_aspect: called CC=1 SCAR=0.0
Pod undocumented
299 1 my ($writer, $feature) = @_;
300  
301 1 $feature->{make_writer} = 1;
302 1 $feature->construct->writer_name($writer);
303 }
304  
305 # reader => $name
306 1 ▶sub reader_aspect {
Subroutine reader_aspect: called CC=1 SCAR=0.0
Pod undocumented
307 1 my ($reader, $feature) = @_;
308  
309 1 $feature->{make_reader} = 1;
310 1 $feature->construct->reader_name($reader);
311 }
312  
313 # predicate => $name
314 1 ▶sub predicate_aspect {
Subroutine predicate_aspect: called CC=1 SCAR=0.0
Pod undocumented
315 1 my ($predicate, $feature) = @_;
316  
317 1 $feature->{make_predicate} = 1;
318 1 $feature->construct->predicate_name($predicate);
319 }
320  
321 # clearer => $name
322 1 ▶sub clearer_aspect {
Subroutine clearer_aspect: called CC=1 SCAR=0.0
Pod undocumented
323 1 my ($clearer, $feature) = @_;
324  
325 1 $feature->{make_clearer} = 1;
326 1 $feature->construct->clearer_name($clearer);
327 }
328  
329 # cleaner => $sub
330 1 ▶sub cleaner_aspect {
Subroutine cleaner_aspect: called CC=1 SCAR=0.0
Pod undocumented
331 1 my ($cleaner, $feature) = @_;
332  
333 1 my ($cls, $construct) = @$feature{qw/pkg construct/};
334
335 1 $feature->{cleaner} = $cleaner;
336  
337 1 $construct->add_cleaner("${\$feature->meta}\{cleaner}->(\$self);");
338 }
339  
340 # Расширяет класс или роль
341 22 ▶sub inherits($$@) {
Subroutine inherits: called CC=20 SCAR=30.3
Pod documented
342 22 my $pkg = shift; my $is_with = shift;
343  
344 22 is_aion $pkg;
345  
346 22 my $own_meta = $Aion::META{$pkg};
347  
348 22 push @{"${pkg}::ISA"}, @_;
349 22 ▶ push @{$is_with? $own_meta->{with}: $own_meta->{extends}}, @_;
Branch: 1 branch
BranchTrueFalseTotal
$is_with ? : 19 3 22
350  
351 22 my @use_only;
352
353 22 ▶ if(${^GLOBAL_PHASE} eq 'RUN') {
Branch: 1 branch
BranchTrueFalseTotal
if (${^GLOBAL_PHASE} eq "RUN") 18 4 22
354 18 for my $module (@_) {
355 21 my $meta = $Aion::META{$module};
356 21 ▶ push @use_only, $module if $meta && $meta->{use_only};
Branch: 1 branch
BranchTrueFalseTotal
if $meta and $meta->{"use_only"} 2 19 21
Condition66%2/3
$meta and $meta->{"use_only"}
!ll&&!rl&&r
0192
MC/DC50%1/2
$meta and $meta->{"use_only"}
$meta $meta->{"use_only"}
Truth table66%2/3
A and B
A= $metaB= $meta->{"use_only"}
ABresult
0X0
100
111
357 }
358 }
359
360 22 ▶ die "use: use Aion ${\($is_with? 'with': 'extends')} => [qw/@use_only/];" if @use_only;
Branch: 2 branches
BranchTrueFalseTotal
if @use_only 1 21 22
$is_with ? : 1 0 1
361
362 # Добавляем наследуемые свойства и атрибуты
363 21 for my $module (@_) {
364 25 ▶ eval "require $module" or die unless $module->can('with') || $module->can('new');
Branch: 1 branch
BranchTrueFalseTotal
unless $module->can("with") or $module->can("new") 2 23 25
Condition62%5/8
$module->can('with') || $module->can('new') || (eval "require $module" || die())
l!l
2320
$module->can("with") or $module->can("new")
l!l&&r!l&&!r
2302
eval "require $module" or die
l!l
20
MC/DC0%0/3
$module->can('with') || $module->can('new') || (eval "require $module" || die())
$module->can("with") $module->can("new") eval "require $module"
Truth table25%1/4
A or B || C
A= $module->can("with")B= $module->can("new")C= eval "require $module"
ABCresult
1XX1
01X1
0011
0000
365  
366 25 ▶ if(my $meta = $Aion::META{$module}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $meta = $Aion::META{$module}) 25 0 25
367 25 for my $property (qw/aspect feature require havelock/) {
368 100 ▶ my $inherit_property_href = $meta->{$property} // next;
Condition50%1/2
$meta->{$property} // (next)
l!l
1000
MC/DC0%0/1
$meta->{$property} // (next)
$meta->{$property}
Truth table50%1/2
A
A= $meta->{$property}
Aresult
11
00
369 100 ▶ my $own_property_href = $own_meta->{$property} //= {};
Condition50%1/2
$own_meta->{$property} //= {}
l!l
1000
MC/DC0%0/1
$own_meta->{$property} //= {}
$own_meta->{$property}
Truth table50%1/2
A
A= $own_meta->{$property}
Aresult
11
00
370 100 %$own_property_href = (%$own_property_href, %$inherit_property_href);
371 }
372  
373 25 for my $sub (@{$meta->{export}}) {
374 2 *{"$pkg\::$sub"} = $module->can($sub);
375 }
376 }
377 }
378  
379 21 ▶ my $import_name = $is_with? 'import_with': 'import_extends';
Branch: 1 branch
BranchTrueFalseTotal
$is_with ? : 18 3 21
380 21 for my $module (@_) {
381 25 my $import = $module->can($import_name);
382 25 ▶ $import->($module, $pkg) if $import;
Branch: 1 branch
BranchTrueFalseTotal
if $import 3 22 25
383 }
384  
385 21 return;
386 }
387  
388 # Наследование классов
389 3 ▶sub extends(@) {
Subroutine extends: called CC=1 SCAR=0.0
Pod documented
390 3 unshift @_, scalar caller, 0;
391 3 goto &inherits;
392 }
393  
394 # Расширение ролями
395 17 ▶sub with(@) {
Subroutine with: called CC=1 SCAR=0.0
Pod documented
396 17 unshift @_, scalar caller, 1;
397 17 goto &inherits;
398 }
399  
400 # Вызывает подстрекателя для настройки класса
401 1 ▶sub have(@) {
Subroutine have: called CC=2 SCAR=7.0
Pod documented
402 1 my ($name, @options) = @_;
403 1 my $pkg = caller;
404  
405 1 is_aion $pkg;
406  
407 1 my $meta = $Aion::META{$pkg};
408 1 ▶ my $inciter_sub = $meta->{havelock}{$name} // die "Havelock `$name` not exists!";
Condition50%1/2
$meta->{"havelock"}{$name} // die("Havelock `$name` not exists!")
l!l
10
MC/DC0%0/1
$meta->{"havelock"}{$name} // die("Havelock `$name` not exists!")
$meta->{"havelock"}{$name}
Truth table50%1/2
A
A= $meta->{"havelock"}{$name}
Aresult
11
00
409  
410 1 local $meta->{have} = $name;
411 1 $inciter_sub->($meta, @options);
412 1 return;
413 }
414  
415 # Устанавливает подстрекатель для настройки класса
416 1 ▶sub havelock($$) {
Subroutine havelock: called CC=3 SCAR=11.2
Pod documented
417 1 my ($name, $sub) = @_;
418 1 my $pkg = caller;
419  
420 1 is_aion $pkg;
421  
422 1 ▶ my $havelock = $Aion::META{$pkg}{havelock} //= {};
Condition50%1/2
$Aion::META{$pkg}{"havelock"} //= {}
l!l
10
MC/DC0%0/1
$Aion::META{$pkg}{"havelock"} //= {}
$Aion::META{$pkg}{"havelock"}
Truth table50%1/2
A
A= $Aion::META{$pkg}{"havelock"}
Aresult
11
00
423 1 ▶ die "Havelock `$name` exists!" if exists $havelock->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $havelock->{$name} 0 1 1
424 1 $havelock->{$name} = $sub;
425 1 return;
426 }
427  
428 1 ▶sub requires(@) {
Subroutine requires: called CC=2 SCAR=6.9
Pod documented
429 1 my $pkg = caller;
430  
431 1 is_aion $pkg;
432  
433 #TODO: добавить проверку на существование
434 1 $Aion::META{$pkg}{require}{$_} = Aion::Meta::RequiresAnyFunction->new(pkg => $pkg, name => $_) for @_;
435 }
436  
437 # Требуется свойство
438 5 ▶sub req(@) {
Subroutine req: called CC=1 SCAR=0.0
Pod documented
439 5 my ($name) = @_;
440 5 my $pkg = caller;
441  
442 5 is_aion $pkg;
443  
444 5 my $meta = $Aion::META{$pkg};
445  
446 #TODO: добавить проверку на существование по модулю и сравнить, что не одинаковы, если модули не совпадают
447 # die "Feature `$name` already required!" if exists $meta->{require}{$name};
448  
449 5 $meta->{require}{$name} = Aion::Meta::RequiresFeature->new($pkg, @_);
450 5 return;
451 }
452  
453 # Добавляется аспект
454 2 ▶sub aspect($$) {
Subroutine aspect: called CC=2 SCAR=7.0
Pod documented
455 2 my ($name, $sub) = @_;
456 2 my $pkg = caller;
457  
458 2 is_aion $pkg;
459  
460 2 my $ASPECT = $Aion::META{$pkg}{aspect};
461 2 ▶ die "Aspect `$name` exists!" if exists $ASPECT->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $ASPECT->{$name} 0 2 2
462 2 $ASPECT->{$name} = $sub;
463 2 return;
464 }
465  
466 # Ищет именно классы, а не роли
467 7 ▶sub exactly {
Subroutine exactly: called CC=2 SCAR=6.9
Pod documented
468 7 my ($self, $class) = @_;
469 7 ▶ return '' if Aion::Types::ClassName->exclude($class);
Branch: 1 branch
BranchTrueFalseTotal
if &Aion::Types::ClassName()->exclude($class) 1 6 7
470 6 goto &UNIVERSAL::isa;
471 }
472  
473  
474 # Определяет - подключена ли роль
475 6 ▶sub does {
Subroutine does: called CC=2 SCAR=6.9
Pod documented
476 6 my ($self, $role) = @_;
477 6 ▶ return '' if Aion::Types::ClassName->include($role);
Branch: 1 branch
BranchTrueFalseTotal
if &Aion::Types::ClassName()->include($role) 1 5 6
478 5 goto &UNIVERSAL::isa;
479 }
480  
481 # Создаёт свойство
482 53 ▶sub has(@) {
Subroutine has: called CC=7 SCAR=19.7
Pod documented
483 53 my $property = shift;
484  
485 53 my $pkg = caller;
486 53 is_aion $pkg;
487  
488 53 my %opt = @_;
489 53 my $meta = $Aion::META{$pkg};
490  
491 # создаём фичи
492 53 ▶ for my $name (ref $property? @$property: $property) {
Branch: 1 branch
BranchTrueFalseTotal
ref $property ? : 1 52 53
493  
494 die "has: the method $name is already in the package $pkg"
495 54 ▶ if $pkg->can($name) && !exists $meta->{feature}{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $pkg->can($name) and not exists $meta->{"feature"}{$name} 0 54 54
Condition33%1/3
$pkg->can($name) and not exists $meta->{"feature"}{$name}
!ll&&!rl&&r
5400
MC/DC0%0/2
$pkg->can($name) and not exists $meta->{"feature"}{$name}
$pkg->can($name) not exists $meta->{"feature"}{$name}
Truth table33%1/3
A and not(B)
A= $pkg->can($name)B= not exists $meta->{"feature"}{$name}
ABresult
0X0
100
111
496  
497 54 my $feature = Aion::Meta::Feature->new($pkg, $name, @_);
498  
499 54 my $require = delete $meta->{require}{$name};
500 54 ▶ $require->compare($feature) if $require;
Branch: 1 branch
BranchTrueFalseTotal
if $require 4 50 54
501  
502 53 my $overload = $meta->{feature}{$name};
503 53 ▶ $overload->compare($feature) if $overload;
Branch: 1 branch
BranchTrueFalseTotal
if $overload 0 53 53
504
505 53 $feature->mk_property;
506 53 $meta->{feature}{$name} = $feature;
507 }
508 52 return;
509 }
510  
511 # Инициализатор: закрывает класс и заменяется на конструктор
512 43 ▶sub initialize {
Subroutine initialize: called CC=9 SCAR=26.8
Pod undocumented
513 43 my ($cls) = @_;
514  
515 43 ▶ $cls = ref $cls || $cls;
Condition33%1/3
ref $cls || $cls
l!l&&r!l&&!r
0430
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
516 43 is_aion $cls;
517  
518 43 my $REQUIRE = $Aion::META{$cls}{require};
519 43 my $FEATURE = $Aion::META{$cls}{feature};
520 43 my $SUBROUTINE = $Aion::META{$cls}{subroutine};
521 43 for my $key (keys %$REQUIRE) {
522 7 my $require = $REQUIRE->{$key};
523
524 7 ▶ if ($require->isa('Aion::Meta::RequiresAnyFunction')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($require->isa('Aion::Meta::RequiresAnyFunction')) { } 2 5 7
elsif ($require->isa('Aion::Meta::RequiresFeature')) { } 1 4 5
525 2 $require->compare($cls->can($key));
526 } elsif ($require->isa('Aion::Meta::RequiresFeature')) {
527 1 $require->compare($FEATURE->{$require->name});
528 } else {
529 4 $require->compare($SUBROUTINE->{$require->subname});
530 }
531 }
532  
533 40 %$REQUIRE = ();
534  
535 # TODO: очищать класс от вспомогательных функций
536 #eval "package $cls; Aion->unimport; 1" or die;
537  
538 40 my $new = << 'END';
539 package %(cls)s {
540 sub new {
541 my ($cls, %value) = @_;
542 $cls = ref $cls || $cls;
543 my $self = bless {}, $cls;
544
545 %(initializers)s
546
547 if(scalar keys %value) {
548 my @fakekeys = sort keys %value;
549 die "@fakekeys is'nt feature!" if @fakekeys == 1;
550 local $" = ", ";
551 die "@fakekeys is'nt features!"
552 }
553  
554 return $self;
555 }
556 }
557 END
558  
559 40 my @destroyers;
560 my $initializers = join "", map {
561 52 ▶ push @destroyers, $_->{construct}->destroyer if $_->{cleaner};
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"cleaner"} 1 51 52
562 $_->{construct}->initializer
563 40 } sort { $a->{order} <=> $b->{order} } values %$FEATURE;
564
565 40 my %var = (
566 cls => $cls,
567 initializers => $initializers,
568 );
569
570 40 $new =~ s/%\((\w+)\)s/$var{$1}/ge;
571  
572 0 ▶ eval $new;
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=7 SCAR=24.0
Subroutine new: called CC=7 SCAR=24.0
Subroutine new: called CC=4 SCAR=16.7
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=7 SCAR=24.0
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=7 SCAR=24.0
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=7 SCAR=24.0
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=5 SCAR=19.5
Subroutine new: called CC=4 SCAR=16.7
Subroutine new: called CC=4 SCAR=16.7
Subroutine new: called CC=4 SCAR=16.7
Branch: 106 branches
BranchTrueFalseTotal
if (exists $value{'a'}) { } 3 10 13
if (exists $value{'b'}) { } 2 10 12
if (exists $value{'op'}) { } 0 10 10
if (scalar keys %value) 0 10 10
if @fakekeys == 1 0 0 0
if (exists $value{'type'}) { } 5 0 5
if (exists $value{'name'}) { } 2 3 5
if (scalar keys %value) 1 2 3
if @fakekeys == 1 0 2 2
if (exists $value{"key1"}) 4 0 4
if (exists $value{"key2"}) 1 3 4
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"moon"}) 2 2 4
if (scalar keys %value) 0 4 4
if @fakekeys == 1 0 0 0
if (exists $value{'ini'}) { } 1 1 2
if (exists $value{"pleroma"}) 1 1 2
if (exists $value{'eon'}) { } 0 2 2
if (scalar keys %value) 0 2 2
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 1 5 6
if (exists $value{'y'}) { } 5 1 6
if (exists $value{"z"}) 1 4 5
if (scalar keys %value) 2 2 4
if @fakekeys == 1 1 1 2
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{'x'}) { } 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{'legs'}) { } 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"rw"}) 2 7 9
if (exists $value{'ro'}) { } 8 1 9
if (exists $value{"wo"}) 1 7 8
if (scalar keys %value) 0 7 7
if @fakekeys == 1 0 0 0
if (exists $value{"parent"}) 1 2 3
if (scalar keys %value) 0 3 3
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 2 3 5
if (exists $value{"y"}) 1 3 4
if (exists $value{"z"}) 1 2 3
if (scalar keys %value) 0 3 3
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 2 0 2
if (scalar keys %value) 0 2 2
if @fakekeys == 1 0 0 0
if (exists $value{'x'}) { } 1 1 2
if (scalar keys %value) 0 2 2
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{'x'}) { } 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"accomulator"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"power"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"counter"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 1 0 1
exists $self->{'x'} ? : 0 1 1
if (exists $value{"y"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 1 0 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{'init_x'}) { } 1 0 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 1 0 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 0 1 1
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (exists $value{"x"}) 2 0 2
if (scalar keys %value) 0 2 2
if @fakekeys == 1 0 0 0
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
if (scalar keys %value) 0 1 1
if @fakekeys == 1 0 0 0
Condition33%32/96
ref $cls || $cls
l!l&&r!l&&!r
0130
ref $cls || $cls
l!l&&r!l&&!r
050
ref $cls || $cls
l!l&&r!l&&!r
040
ref $cls || $cls
l!l&&r!l&&!r
040
ref $cls || $cls
l!l&&r!l&&!r
020
ref $cls || $cls
l!l&&r!l&&!r
060
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
090
ref $cls || $cls
l!l&&r!l&&!r
030
ref $cls || $cls
l!l&&r!l&&!r
050
ref $cls || $cls
l!l&&r!l&&!r
020
ref $cls || $cls
l!l&&r!l&&!r
020
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
020
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
ref $cls || $cls
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
MC/DC0%0/2
ref $cls || $cls
ref $cls $cls
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
Truth table33%1/3
A || B
A= ref $clsB= $cls
ABresult
1X1
011
000
573 40 ▶ die if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 40 40
574  
575 40 ▶ if (@destroyers) {
Branch: 1 branch
BranchTrueFalseTotal
if (@destroyers) 1 39 40
576 1 my $destroyer = << 'END';
577 package %(cls)s {
578 sub DESTROY {
579 my ($self) = @_;
580  
581 warn "${\ref $self}#${\Scalar::Util::id $self} destroy in global phase!" if ${^GLOBAL_PHASE} eq 'DESTRUCT';
582  
583 %(destroyers)s
584 }
585 }
586 END
587  
588 1 my %var = (
589 cls => $cls,
590 destroyers => join "", @destroyers,
591 );
592
593 1 $destroyer =~ s/%\((\w+)\)s/$var{$1}/ge;
594  
595 0 ▶ eval $destroyer;
Subroutine DESTROY: called CC=4 SCAR=14.6
Branch: 3 branches
BranchTrueFalseTotal
if ${^GLOBAL_PHASE} eq "DESTRUCT" 0 2 2
if (exists $self->{"x"}) 1 1 2
if $@ 0 1 1
596 1 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
597 }
598
599 40 goto &{"${cls}::new"};
600 }
601  
602 1 1;
603  
604 __END__
« blib/lib/Aion/Type/DNF.pm ↑ Summary blib/lib/Aion/Pleroma.pm »