);
push @initial_value, (
- '$attrs->[' . $idx . ']->set_initial_value(',
+ '$attrs[' . $idx . ']->set_initial_value(',
'$instance,',
$attr->_inline_instance_get('$instance'),
');',
my @initial_value = $attr->_inline_set_value('$instance', $default);
push @initial_value, (
- '$attrs->[' . $idx . ']->set_initial_value(',
+ '$attrs[' . $idx . ']->set_initial_value(',
'$instance,',
$attr->_inline_instance_get('$instance'),
');',
# in which case we can just deal with them
# in the code we eval.
if ($attr->is_default_a_coderef) {
- return '$defaults->[' . $index . ']->($instance)';
+ return '$defaults[' . $index . ']->($instance)';
}
else {
- return '$defaults->[' . $index . ']';
+ return '$defaults[' . $index . ']';
}
}
elsif ($attr->has_builder) {
my @attrs = sort { $a->name cmp $b->name } $self->get_all_attributes;
- my $defaults = [map { $_->default } @attrs];
+ my @defaults = map { $_->default } @attrs;
return {
- '$defaults' => \$defaults,
+ '@defaults' => \@defaults,
};
}
);
push @initial_value, (
- '$attrs->[' . $idx . ']->set_initial_value(',
+ '$attrs[' . $idx . ']->set_initial_value(',
'$instance,',
$attr->_inline_instance_get('$instance'),
');',
);
push @initial_value, (
- '$attrs->[' . $idx . ']->set_initial_value(',
+ '$attrs[' . $idx . ']->set_initial_value(',
'$instance,',
$attr->_inline_instance_get('$instance'),
');',
push @trigger_calls,
'if (exists $params->{\'' . $init_arg . '\'}) {',
- '$triggers->[' . $i . ']->(',
+ '$triggers[' . $i . ']->(',
'$instance,',
$attr->_inline_instance_get('$instance') . ',',
');',
my @attrs = sort { $a->name cmp $b->name } $self->get_all_attributes;
- my $triggers = [
+ my @triggers = (
map { $_->can('has_trigger') && $_->has_trigger ? $_->trigger : undef }
@attrs
- ];
+ );
# We need to check if the attribute ->can('type_constraint')
# since we may be trying to immutabilize a Moose meta class,
return {
%{ $self->SUPER::_eval_environment },
((any { defined && $_->has_initializer } @attrs)
- ? ('$attrs' => \[@attrs])
+ ? ('@attrs' => \@attrs)
: ()),
- '$triggers' => \$triggers,
+ '@triggers' => \@triggers,
'@type_coercions' => \@type_coercions,
'@type_constraint_bodies' => \@type_constraint_bodies,
'@type_constraint_messages' => \@type_constraint_messages,