!grep $spec->{$_}, qw(isa trigger weak_ref);
}
+sub has_eager_default {
+ my ($self, $name, $spec) = @_;
+ (!$spec->{lazy} and ($spec->{default} or $spec->{builder}));
+}
+
sub _generate_get {
my ($self, $name, $spec) = @_;
my $simple = $self->_generate_simple_get('$_[0]', $name);
sub _generate_populate_set {
my ($self, $me, $name, $spec, $source, $test) = @_;
- if (!$spec->{lazy} and
- ($spec->{default} or $spec->{builder})) {
+ if ($self->has_eager_default($name, $spec)) {
my $get_indent = ' ' x ($spec->{isa} ? 6 : 4);
my $get_default = $self->_generate_get_default(
'$new', $_, $spec
my $attr_spec = $spec->{$name};
unless ($ag->is_simple_attribute($name, $attr_spec)) {
next NAME unless defined($attr_spec->{init_arg})
- or (($attr_spec->{default} or $attr_spec->{builder})
- and not $attr_spec->{lazy});
+ or $ag->has_eager_default($name, $attr_spec);
$test{$name} = $attr_spec->{init_arg};
next NAME;
}