Common attribute idioms
Dependent default values
- Make them lazy
has 'bar' => (
is => 'rw',
lazy => 1,
default => sub {
my $self = shift;
Foo->new(baz => $self->baz)
}
);
- bar attribute will not be initialized until read