In a profile of my app that uses this, this small function took up more time than any other function, because it's called so damn often.
unless grep { $_->isa('Moose::Object') } @parents;
my $container_pkg = 'MooseX::ClassAttribute::Container::' . $caller;
+ my $instance_holder = $container_pkg . '::Self';
my $instance_meth = sub {
no strict 'refs'; ## no critic ProhibitNoStrict
- return ${ $container_pkg . '::Self' } ||= shift->new(@_);
+ return $$instance_holder ||= shift->new(@_);
};
my $class =