| 1 | package Moo::HandleMoose; | ||||||||||||||||||||||||||||
| 2 | 41 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 41 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 41 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 41 | ▶ | use Moo::_Utils qw(_getstash); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 41 | ▶ | use Sub::Quote qw(quotify); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 41 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 41 | our %TYPE_MAP; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 41 | our $SETUP_DONE; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 45 | ▶ | sub import { return if $SETUP_DONE; inject_all(); $SETUP_DONE = 1; } | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 41 | ▶ | sub inject_all { | ||||||||||||||||||||||||||
|
Subroutine
inject_all: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 41 | ▶ | croak "Can't inflate Moose metaclass with Moo::sification disabled" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | if $Moo::sification::disabled; | ||||||||||||||||||||||||||||
| 19 | 39 | require Class::MOP; | |||||||||||||||||||||||||||
| 20 | inject_fake_metaclass_for($_) | ||||||||||||||||||||||||||||
| 21 | 39 | for grep $_ ne 'Moo::Object', keys %Moo::MAKERS; | |||||||||||||||||||||||||||
| 22 | 39 | inject_fake_metaclass_for($_) for keys %Moo::Role::INFO; | |||||||||||||||||||||||||||
| 23 | 39 | require Moose::Meta::Method::Constructor; | |||||||||||||||||||||||||||
| 24 | 39 | @Moo::HandleMoose::FakeConstructor::ISA = 'Moose::Meta::Method::Constructor'; | |||||||||||||||||||||||||||
| 25 | 39 | @Moo::HandleMoose::FakeMeta::ISA = 'Moose::Meta::Method::Meta'; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 89 | ▶ | sub maybe_reinject_fake_metaclass_for { | ||||||||||||||||||||||||||
|
Subroutine
maybe_reinject_fake_metaclass_for: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 89 | my ($name) = @_; | |||||||||||||||||||||||||||
| 30 | 89 | our %DID_INJECT; | |||||||||||||||||||||||||||
| 31 | 89 | ▶ | if (delete $DID_INJECT{$name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 4 | ▶ | unless ($Moo::Role::INFO{$name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 2 | Moo->_constructor_maker_for($name)->install_delayed; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | 4 | inject_fake_metaclass_for($name); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 120 | ▶ | sub inject_fake_metaclass_for { | ||||||||||||||||||||||||||
|
Subroutine
inject_fake_metaclass_for: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 120 | my ($name) = @_; | |||||||||||||||||||||||||||
| 41 | 120 | require Class::MOP; | |||||||||||||||||||||||||||
| 42 | 120 | require Moo::HandleMoose::FakeMetaClass; | |||||||||||||||||||||||||||
| 43 | 120 | Class::MOP::store_metaclass_by_name( | |||||||||||||||||||||||||||
| 44 | $name, bless({ name => $name }, 'Moo::HandleMoose::FakeMetaClass') | ||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||
| 46 | 120 | require Moose::Util::TypeConstraints; | |||||||||||||||||||||||||||
| 47 | 120 | ▶ | if ($Moo::Role::INFO{$name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 37 | Moose::Util::TypeConstraints::find_or_create_does_type_constraint($name); | |||||||||||||||||||||||||||
| 49 | } else { | ||||||||||||||||||||||||||||
| 50 | 83 | Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($name); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | package Moo::HandleMoose::FakeConstructor; | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 8 | ▶ | sub _uninlined_body { \&Moose::Object::new } | ||||||||||||||||||||||||||
|
Subroutine
_uninlined_body: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 41 | ▶ | sub inject_real_metaclass_for { | ||||||||||||||||||||||||||
|
Subroutine
inject_real_metaclass_for: called CC=40 SCAR=36.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 61 | 126 | my ($name) = @_; | |||||||||||||||||||||||||||
| 62 | 126 | our %DID_INJECT; | |||||||||||||||||||||||||||
| 63 | 126 | ▶ | return Class::MOP::get_metaclass_by_name($name) if $DID_INJECT{$name}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 69 | require Moose; require Moo; require Moo::Role; require Scalar::Util; | |||||||||||||||||||||||||||
| 65 | 69 | require Sub::Defer; | |||||||||||||||||||||||||||
| 66 | 69 | Class::MOP::remove_metaclass_by_name($name); | |||||||||||||||||||||||||||
| 67 | 69 | my ($am_role, $am_class, $meta, $attr_specs, $attr_order) = do { | |||||||||||||||||||||||||||
| 68 | 69 | ▶ | if (my $info = $Moo::Role::INFO{$name}) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 69 | 31 | ▶ | my @attr_info = @{$info->{attributes}||[]}; | ||||||||||||||||||||||||||
|
Condition100%2/2
$info->{'attributes'} || []
MC/DC100%1/1
$info->{'attributes'} || []
$info->{'attributes'}
Truth table100%2/2
A
A= $info->{'attributes'}
| |||||||||||||||||||||||||||||
| 70 | 31 | (1, 0, Moose::Meta::Role->initialize($name), | |||||||||||||||||||||||||||
| 71 | { @attr_info }, | ||||||||||||||||||||||||||||
| 72 | [ @attr_info[grep !($_ % 2), 0..$#attr_info] ] | ||||||||||||||||||||||||||||
| 73 | ) | ||||||||||||||||||||||||||||
| 74 | } elsif ( my $cmaker = Moo->_constructor_maker_for($name) ) { | ||||||||||||||||||||||||||||
| 75 | 31 | my $specs = $cmaker->all_attribute_specs; | |||||||||||||||||||||||||||
| 76 | (0, 1, Moose::Meta::Class->initialize($name), $specs, | ||||||||||||||||||||||||||||
| 77 | 31 | [ sort { $specs->{$a}{index} <=> $specs->{$b}{index} } keys %$specs ] | |||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||
| 79 | } else { | ||||||||||||||||||||||||||||
| 80 | # This codepath is used if $name does not exist in $Moo::MAKERS | ||||||||||||||||||||||||||||
| 81 | 7 | (0, 0, Moose::Meta::Class->initialize($name), {}, [] ) | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | }; | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | { | ||||||||||||||||||||||||||||
| 86 | 69 | local $DID_INJECT{$name} = 1; | |||||||||||||||||||||||||||
| 87 | 69 | foreach my $spec (values %$attr_specs) { | |||||||||||||||||||||||||||
| 88 | 61 | ▶ | if (my $inflators = delete $spec->{moosify}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 4 | $_->($spec) for @$inflators; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | my %methods | ||||||||||||||||||||||||||||
| 94 | 69 | ▶ | = %{($am_role ? 'Moo::Role' : 'Moo')->_concrete_methods_of($name)}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | # if stuff gets added afterwards, _maybe_reset_handlemoose should | ||||||||||||||||||||||||||||
| 97 | # trigger the recreation of the metaclass but we need to ensure the | ||||||||||||||||||||||||||||
| 98 | # Moo::Role cache is cleared so we don't confuse Moo itself. | ||||||||||||||||||||||||||||
| 99 | 69 | ▶ | if (my $info = $Moo::Role::INFO{$name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 31 | delete $info->{methods}; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | # needed to ensure the method body is stable and get things named | ||||||||||||||||||||||||||||
| 104 | $methods{$_} = Sub::Defer::undefer_sub($methods{$_}) | ||||||||||||||||||||||||||||
| 105 | 69 | for | |||||||||||||||||||||||||||
| 106 | grep $_ ne 'new', | ||||||||||||||||||||||||||||
| 107 | keys %methods; | ||||||||||||||||||||||||||||
| 108 | 69 | my @attrs; | |||||||||||||||||||||||||||
| 109 | { | ||||||||||||||||||||||||||||
| 110 | # This local is completely not required for roles but harmless | ||||||||||||||||||||||||||||
| 111 | 69 | local @{_getstash($name)}{keys %methods}; | |||||||||||||||||||||||||||
| 112 | 69 | my %seen_name; | |||||||||||||||||||||||||||
| 113 | 69 | foreach my $attr_name (@$attr_order) { | |||||||||||||||||||||||||||
| 114 | 61 | $seen_name{$attr_name} = 1; | |||||||||||||||||||||||||||
| 115 | 61 | my %spec = %{$attr_specs->{$attr_name}}; | |||||||||||||||||||||||||||
| 116 | my %spec_map = ( | ||||||||||||||||||||||||||||
| 117 | 1772 | ▶ | map { $_->name => $_->init_arg||$_->name } | ||||||||||||||||||||||||||
|
Condition66%2/3
$_->init_arg || $_->name
MC/DC0%0/2
$_->init_arg || $_->name
$_->init_arg
$_->name
Truth table66%2/3
A || B
A= $_->init_argB= $_->name
| |||||||||||||||||||||||||||||
| 118 | ( | ||||||||||||||||||||||||||||
| 119 | 1769 | (grep { $_->has_init_arg } | |||||||||||||||||||||||||||
| 120 | $meta->attribute_metaclass->meta->get_all_attributes), | ||||||||||||||||||||||||||||
| 121 | 4 | ▶ | grep { exists($_->{init_arg}) ? defined($_->init_arg) : 1 } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | map { | ||||||||||||||||||||||||||||
| 123 | 3 | my $meta = Moose::Util::resolve_metatrait_alias('Attribute', $_) | |||||||||||||||||||||||||||
| 124 | ->meta; | ||||||||||||||||||||||||||||
| 125 | 3 | map $meta->get_attribute($_), $meta->get_attribute_list | |||||||||||||||||||||||||||
| 126 | 61 | ▶ | } @{$spec{traits}||[]} | ||||||||||||||||||||||||||
|
Condition100%2/2
$spec{'traits'} || []
MC/DC100%1/1
$spec{'traits'} || []
$spec{'traits'}
Truth table100%2/2
A
A= $spec{'traits'}
| |||||||||||||||||||||||||||||
| 127 | ) | ||||||||||||||||||||||||||||
| 128 | ); | ||||||||||||||||||||||||||||
| 129 | # have to hard code this because Moose's role meta-model is lacking | ||||||||||||||||||||||||||||
| 130 | 61 | ▶ | $spec_map{traits} ||= 'traits'; | ||||||||||||||||||||||||||
|
Condition100%2/2
$spec_map{"traits"} ||= "traits"
MC/DC100%1/1
$spec_map{"traits"} ||= "traits"
$spec_map{"traits"}
Truth table100%2/2
A
A= $spec_map{"traits"}
| |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 61 | ▶ | $spec{is} = 'ro' if $spec{is} eq 'lazy' or $spec{is} eq 'rwp'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$spec{"is"} eq "lazy" or $spec{"is"} eq "rwp"
MC/DC50%1/2
$spec{"is"} eq "lazy" or $spec{"is"} eq "rwp"
$spec{"is"} eq "lazy"
$spec{"is"} eq "rwp"
Truth table66%2/3
A or B
A= $spec{"is"} eq "lazy"B= $spec{"is"} eq "rwp"
| |||||||||||||||||||||||||||||
| 133 | 61 | my $coerce = $spec{coerce}; | |||||||||||||||||||||||||||
| 134 | 61 | ▶ | if (my $isa = $spec{isa}) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 135 | 11 | my $tc = $spec{isa} = do { | |||||||||||||||||||||||||||
| 136 | 11 | ▶ | if (my $mapped = $TYPE_MAP{$isa}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 8 | my $type = $mapped->(); | |||||||||||||||||||||||||||
| 138 | 8 | ▶ | unless ( Scalar::Util::blessed($type) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($type) and $type->isa("Moose::Meta::TypeConstraint")
MC/DC50%1/2
builtin::blessed($type) and $type->isa("Moose::Meta::TypeConstraint")
builtin::blessed($type)
$type->isa("Moose::Meta::TypeConstraint")
Truth table66%2/3
A and B
A= builtin::blessed($type)B= $type->isa("Moose::Meta::TypeConstraint")
| |||||||||||||||||||||||||||||
| 139 | && $type->isa("Moose::Meta::TypeConstraint") ) { | ||||||||||||||||||||||||||||
| 140 | 2 | croak "error inflating attribute '$attr_name' for package '$name': " | |||||||||||||||||||||||||||
| 141 | ."\$TYPE_MAP{$isa} did not return a valid type constraint'"; | ||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | 6 | ▶ | $coerce ? $type->create_child_type(name => $type->name) : $type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | } else { | ||||||||||||||||||||||||||||
| 145 | Moose::Meta::TypeConstraint->new( | ||||||||||||||||||||||||||||
| 146 | 12 | ▶ | constraint => sub { eval { &$isa; 1 } } | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 147 | 3 | ); | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | }; | ||||||||||||||||||||||||||||
| 150 | 9 | ▶ | if ($coerce) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 4 | $tc->coercion(Moose::Meta::TypeCoercion->new) | |||||||||||||||||||||||||||
| 152 | ->_compiled_type_coercion($coerce); | ||||||||||||||||||||||||||||
| 153 | 4 | $spec{coerce} = 1; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | } elsif ($coerce) { | ||||||||||||||||||||||||||||
| 156 | 1 | my $attr = quotify($attr_name); | |||||||||||||||||||||||||||
| 157 | my $tc = Moose::Meta::TypeConstraint->new( | ||||||||||||||||||||||||||||
| 158 | 1 | ▶ | constraint => sub { die "This is not going to work" }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 159 | 5 | ▶ | inlined => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 160 | 5 | 'my $r = $_[42]{'.$attr.'}; $_[42]{'.$attr.'} = 1; $r' | |||||||||||||||||||||||||||
| 161 | }, | ||||||||||||||||||||||||||||
| 162 | 1 | ); | |||||||||||||||||||||||||||
| 163 | 1 | $tc->coercion(Moose::Meta::TypeCoercion->new) | |||||||||||||||||||||||||||
| 164 | ->_compiled_type_coercion($coerce); | ||||||||||||||||||||||||||||
| 165 | 1 | $spec{isa} = $tc; | |||||||||||||||||||||||||||
| 166 | 1 | $spec{coerce} = 1; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | %spec = | ||||||||||||||||||||||||||||
| 169 | 168 | map { $spec_map{$_} => $spec{$_} } | |||||||||||||||||||||||||||
| 170 | 59 | grep { exists $spec_map{$_} } | |||||||||||||||||||||||||||
| 171 | keys %spec; | ||||||||||||||||||||||||||||
| 172 | 59 | push @attrs, $meta->add_attribute($attr_name => %spec); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | 66 | ▶ | foreach my $mouse (do { our %MOUSE; @{$MOUSE{$name}||[]} }) { | ||||||||||||||||||||||||||
|
Condition100%2/2
$Moo::HandleMoose::MOUSE{$name} || []
MC/DC100%1/1
$Moo::HandleMoose::MOUSE{$name} || []
$Moo::HandleMoose::MOUSE{$name}
Truth table100%2/2
A
A= $Moo::HandleMoose::MOUSE{$name}
| |||||||||||||||||||||||||||||
| 175 | 2 | foreach my $attr ($mouse->get_all_attributes) { | |||||||||||||||||||||||||||
| 176 | 2 | my %spec = %{$attr}; | |||||||||||||||||||||||||||
| 177 | 2 | delete @spec{qw( | |||||||||||||||||||||||||||
| 178 | associated_class associated_methods __METACLASS__ | ||||||||||||||||||||||||||||
| 179 | provides curries | ||||||||||||||||||||||||||||
| 180 | )}; | ||||||||||||||||||||||||||||
| 181 | 2 | my $attr_name = delete $spec{name}; | |||||||||||||||||||||||||||
| 182 | 2 | ▶ | next if $seen_name{$attr_name}++; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 1 | push @attrs, $meta->add_attribute($attr_name => %spec); | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | 66 | foreach my $meth_name (keys %methods) { | |||||||||||||||||||||||||||
| 188 | 226 | my $meth_code = $methods{$meth_name}; | |||||||||||||||||||||||||||
| 189 | 226 | $meta->add_method($meth_name, $meth_code); | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 66 | ▶ | if ($am_role) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 193 | 31 | my $info = $Moo::Role::INFO{$name}; | |||||||||||||||||||||||||||
| 194 | 31 | $meta->add_required_methods(@{$info->{requires}}); | |||||||||||||||||||||||||||
| 195 | 31 | foreach my $modifier (@{$info->{modifiers}}) { | |||||||||||||||||||||||||||
| 196 | 4 | my ($type, @args) = @$modifier; | |||||||||||||||||||||||||||
| 197 | 4 | my $code = pop @args; | |||||||||||||||||||||||||||
| 198 | 4 | $meta->${\"add_${type}_method_modifier"}($_, $code) for @args; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | elsif ($am_class) { | ||||||||||||||||||||||||||||
| 202 | 28 | foreach my $attr (@attrs) { | |||||||||||||||||||||||||||
| 203 | 40 | foreach my $method (@{$attr->associated_methods}) { | |||||||||||||||||||||||||||
| 204 | 36 | $method->{body} = $name->can($method->name); | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | bless( | ||||||||||||||||||||||||||||
| 208 | 28 | $meta->find_method_by_name('new'), | |||||||||||||||||||||||||||
| 209 | 'Moo::HandleMoose::FakeConstructor', | ||||||||||||||||||||||||||||
| 210 | ); | ||||||||||||||||||||||||||||
| 211 | 28 | my $meta_meth; | |||||||||||||||||||||||||||
| 212 | 28 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$meta_meth = $meta->find_method_by_name("meta") and $meta_meth->body == \&Moo::Object::meta
MC/DC100%2/2
$meta_meth = $meta->find_method_by_name("meta") and $meta_meth->body == \&Moo::Object::meta
$meta_meth = $meta->find_method_by_name("meta")
$meta_meth->body == \&Moo::Object::meta
Truth table100%3/3
A and B
A= $meta_meth = $meta->find_method_by_name("meta")B= $meta_meth->body == \&Moo::Object::meta
| |||||||||||||||||||||||||||||
| 213 | $meta_meth = $meta->find_method_by_name('meta') | ||||||||||||||||||||||||||||
| 214 | and $meta_meth->body == \&Moo::Object::meta | ||||||||||||||||||||||||||||
| 215 | ) { | ||||||||||||||||||||||||||||
| 216 | 23 | bless($meta_meth, 'Moo::HandleMoose::FakeMeta'); | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | # a combination of Moo and Moose may bypass a Moo constructor but still | ||||||||||||||||||||||||||||
| 219 | # use a Moo DEMOLISHALL. We need to make sure this is loaded before | ||||||||||||||||||||||||||||
| 220 | # global destruction. | ||||||||||||||||||||||||||||
| 221 | 28 | require Method::Generate::DemolishAll; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | $meta->add_role(Class::MOP::class_of($_)) | ||||||||||||||||||||||||||||
| 224 | 66 | ▶ | for grep !/\|/ && $_ ne $name, # reject Foo|Bar and same-role-as-self | ||||||||||||||||||||||||||
|
Condition100%3/3
!/\|/ && $_ ne $name
MC/DC100%2/2
!/\|/ && $_ ne $name
!/\|/
$_ ne $name
Truth table100%3/3
not(A) && B
A= !/\|/B= $_ ne $name
| |||||||||||||||||||||||||||||
| 225 | 66 | keys %{$Moo::Role::APPLIED_TO{$name}} | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | 66 | $DID_INJECT{$name} = 1; | |||||||||||||||||||||||||||
| 228 | 66 | $meta; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 41 | 1; | |||||||||||||||||||||||||||