If the constructor autovivification call returns 'undef', then the
package we're trying to get the contructor for, ( and from that, the
constructor specs ), that package was not constructed via
package;
use Moo;
doesn't turn up in %Moo::MAKERS, and must either be either Moose::Object itself, or a simple child class of
that.
Therefore, assume it has no attributes, and inflate a minimal
methods-only metaclass.
+ - successfully inflate a metaclass for attributeless classes (RT#86415)
- fix false default values used with non-lazy accessors
- stop built values that fail isa checks still getting stored in the object
- stop lazy+weak_ref accessors re-building their value on every call
{ @attr_info },
[ @attr_info[grep !($_ % 2), 0..$#attr_info] ]
)
- } else {
- my $specs = Moo->_constructor_maker_for($name)->all_attribute_specs;
+ } elsif ( my $cmaker = Moo->_constructor_maker_for($name) ) {
+ my $specs = $cmaker->all_attribute_specs;
(0, Moose::Meta::Class->initialize($name), $specs,
[ sort { $specs->{$a}{index} <=> $specs->{$b}{index} } keys %$specs ]
);
+ } else {
+ # This codepath is used if $name does not exist in $Moo::MAKERS
+ (0, Moose::Meta::Class->initialize($name), {}, [] )
}
};