| 1 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 117 | package Mite::Trait::HasAttributes; | |||||||||||||||||||||||||||||||||||||||||||||
| 4 | 117 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 117 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 117 | ▶ | no warnings qw( once void ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 117 | our $USES_MITE = "Mite::Role"; | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 117 | our $MITE_SHIM = "Mite::Shim"; | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 117 | our $MITE_VERSION = "0.013000"; | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # Mite keywords | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 117 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 117 | my ( $SHIM, $CALLER ) = | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | ( "Mite::Shim", "Mite::Trait::HasAttributes" ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | *after, *around, *before, | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | *field, *has, *param, | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | *requires, *signature_for, *with | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 117 | = do { | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | package Mite::Shim; | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 117 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub { $SHIM->HANDLE_after( $CALLER, "role", @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 351 | ▶ | sub { $SHIM->HANDLE_around( $CALLER, "role", @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 117 | ▶ | sub { $SHIM->HANDLE_before( $CALLER, "role", @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub { $SHIM->HANDLE_has( $CALLER, field => @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 117 | ▶ | sub { $SHIM->HANDLE_has( $CALLER, has => @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub { $SHIM->HANDLE_has( $CALLER, param => @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 117 | ▶ | sub { }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 117 | ▶ | sub { $SHIM->HANDLE_signature_for( $CALLER, "role", @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub { $SHIM->HANDLE_with( $CALLER, @_ ) }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 117 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # Mite imports | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 117 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 117 | require Scalar::Util; | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | 117 | *STRICT = \&Mite::Shim::STRICT; | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | 117 | *bare = \&Mite::Shim::bare; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | 117 | *blessed = \&Scalar::Util::blessed; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 117 | *carp = \&Mite::Shim::carp; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 117 | *confess = \&Mite::Shim::confess; | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | 117 | *croak = \&Mite::Shim::croak; | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | 117 | *false = \&Mite::Shim::false; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | 117 | *guard = \&Mite::Shim::guard; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | 117 | *lazy = \&Mite::Shim::lazy; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | 117 | *lock = \&Mite::Shim::lock; | |||||||||||||||||||||||||||||||||||||||||||||
| 52 | 117 | *ro = \&Mite::Shim::ro; | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 117 | *rw = \&Mite::Shim::rw; | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 117 | *rwp = \&Mite::Shim::rwp; | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 117 | *true = \&Mite::Shim::true; | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | 117 | *unlock = \&Mite::Shim::unlock; | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # Gather metadata for constructor and destructor | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub __META__ { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__META__: not called CC=4 SCAR=26.6
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 117 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $linear_isa = mro::get_linear_isa($class); | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | return { | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | BUILD => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | map { "$_\::BUILD" } reverse @$linear_isa | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | DEMOLISH => [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | map { ( *{$_}{CODE} ) ? ( *{$_}{CODE} ) : () } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | map { "$_\::DEMOLISH" } @$linear_isa | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | HAS_BUILDARGS => $class->can('BUILDARGS'), | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | HAS_FOREIGNBUILDARGS => $class->can('FOREIGNBUILDARGS'), | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # See UNIVERSAL | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub DOES { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DOES: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my ( $self, $role ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | our %DOES; | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | return $DOES{$role} if exists $DOES{$role}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | return 1 if $role eq __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ( $INC{'Moose/Util.pm'} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$INC{"Moose/Util.pm"} and my $meta = Moose::Util::find_meta(ref $self || $self)
ref $self || $self
MC/DC0%0/2
$INC{"Moose/Util.pm"} and my $meta = Moose::Util::find_meta(ref $self || $self)
$INC{"Moose/Util.pm"}
my $meta = Moose::Util::find_meta(ref $self || $self)
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A and B
A= $INC{"Moose/Util.pm"}B= my $meta = Moose::Util::find_meta(ref $self || $self)
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | and my $meta = Moose::Util::find_meta( ref $self or $self ) ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $meta->can('does_role') and $meta->does_role($role) and return 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$meta->can("does_role") and $meta->does_role($role)
MC/DC0%0/2
$meta->can("does_role") and $meta->does_role($role)
$meta->can("does_role")
$meta->does_role($role)
Truth table0%0/3
A and B
A= $meta->can("does_role")B= $meta->does_role($role)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | return $self->SUPER::DOES($role); | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # Alias for Moose/Moo-compatibility | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub does { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
does: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | shift->DOES(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # Method signatures | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 117 | our %SIGNATURE_FOR; | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 123 | ▶ | $SIGNATURE_FOR{"add_attributes"} = sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=21.7
| |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 123 | my $__NEXT__ = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 123 | my ( @out, %tmp, $tmp, $dtmp, @head ); | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 123 | ▶ | @_ >= 1 | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | or | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | croak( "Wrong number of parameters in signature for %s: got %d, %s", | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | "add_attributes", scalar(@_), "expected exactly 1 parameters" ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 123 | @head = splice( @_, 0, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # Parameter invocant (type: Defined) | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 123 | ▶ | ( defined( $head[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | or croak( | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | "Type check failed in signature for add_attributes: %s should be %s", | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | "\$_[0]", "Defined" | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 123 | my $SLURPY = [ @_[ 0 .. $#_ ] ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # Parameter $SLURPY (type: Slurpy[ArrayRef[Mite::Attribute]]) | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 123 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | package Mite::Shim; | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 123 | ▶ | ( ref($SLURPY) eq 'ARRAY' ) and do { | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $SLURPY eq 'ARRAY' && do {
my $ok = 1;
foreach my $i (@{$SLURPY;}) {
$ok = 0, last unless do {
builtin::blessed($i) and $i->isa('Mite::Attribute')
};
};
$ok
}
MC/DC0%0/2
ref $SLURPY eq 'ARRAY' && do {
my $ok = 1;
foreach my $i (@{$SLURPY;}) {
$ok = 0, last unless do {
builtin::blessed($i) and $i->isa('Mite::Attribute')
};
};
$ok
}
ref $SLURPY eq 'ARRAY'
do {
my $ok = 1;
foreach my $i (@{$SLURPY;}) {
$ok = 0, last unless do {
builtin::blessed($i) and $i->isa('Mite::Attribute')
};
};
$ok
}
Truth table33%1/3
A && B
A= ref $SLURPY eq 'ARRAY'B= do {
my $ok = 1;
foreach my $i (@{$SLURPY;}) {
$ok = 0, last unless do {
builtin::blessed($i) and $i->isa('Mite::Attribute')
};
};
$ok
}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 123 | my $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 129 | 123 | for my $i ( @{$SLURPY} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | ( $ok = 0, last ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | unless ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 128 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 117 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 128 | ▶ | Scalar::Util::blessed($i) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
builtin::blessed($i) && $i->isa('Mite::Attribute')
MC/DC0%0/2
builtin::blessed($i) && $i->isa('Mite::Attribute')
builtin::blessed($i)
$i->isa('Mite::Attribute')
Truth table33%1/3
A && B
A= builtin::blessed($i)B= $i->isa('Mite::Attribute')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | and $i->isa(q[Mite::Attribute]); | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 123 | $ok; | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | or croak( | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | "Type check failed in signature for add_attributes: %s should be %s", | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | "\$SLURPY", "ArrayRef[Mite::Attribute]" | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 123 | push( @out, $SLURPY ); | |||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 123 | do { @_ = ( @head, @out ); goto $__NEXT__ }; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 117 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # Callback which classes consuming this role will call | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 136 | ▶ | sub __FINALIZE_APPLICATION__ { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__FINALIZE_APPLICATION__: called CC=9 SCAR=22.7
| |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 136 | my ( $me, $target, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | 136 | our ( %CONSUMERS, @METHOD_MODIFIERS ); | |||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # Ensure a given target only consumes this role once. | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 136 | ▶ | if ( exists $CONSUMERS{$target} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 136 | $CONSUMERS{$target} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 117 | ▶ | my $type = do { no strict 'refs'; ${"$target\::USES_MITE"} }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 136 | ▶ | return if $type ne 'Mite::Class'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 136 | my @missing_methods; | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | 136 | ▶ | @missing_methods = grep( !$target->can($_), | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | "_compile_mop_attributes", "_compile_pragmas", | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | "_function_for_croak", "compilation_stages", | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | "inject_mite_functions" ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | and croak( "$me requires $target to implement methods: " . join q[, ], | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | @missing_methods ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 136 | my @roles = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 136 | ▶ | my %nextargs = %{ $args || {} }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args || {}
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 136 | ▶ | ( $nextargs{-indirect} ||= 0 )++; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$nextargs{"-indirect"} ||= 0
MC/DC0%0/1
$nextargs{"-indirect"} ||= 0
$nextargs{"-indirect"}
Truth table50%1/2
A
A= $nextargs{"-indirect"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 136 | ▶ | croak("PANIC!") if $nextargs{-indirect} > 100; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 136 | for my $role (@roles) { | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $role->__FINALIZE_APPLICATION__( $target, {%nextargs} ); | |||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 136 | my $shim = "Mite::Shim"; | |||||||||||||||||||||||||||||||||||||||||||||
| 183 | 136 | for my $modifier_rule (@METHOD_MODIFIERS) { | |||||||||||||||||||||||||||||||||||||||||||||
| 184 | 680 | my ( $modification, $names, $coderef ) = @$modifier_rule; | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | 680 | my $handler = "HANDLE_$modification"; | |||||||||||||||||||||||||||||||||||||||||||||
| 186 | 680 | $shim->$handler( $target, "class", $names, $coderef ); | |||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 136 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 117 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||