$args{init_arg} = $args{name}
unless exists $args{init_arg};
+
$args{is} ||= '';
+ if ( $args{lazy_build} ) {
+ $args{lazy} = 1;
+ $args{builder} ||= "_build_$args{name}";
+ }
+
bless \%args, $class;
}
};
has age => (
- is => 'ro',
- isa => 'Int',
- builder => '_build_age',
- lazy => 1,
- clearer => 'clear_age',
- predicate => 'has_age',
+ is => 'ro',
+ isa => 'Int',
+ lazy_build => 1,
+ clearer => 'clear_age',
+ predicate => 'has_age',
);
sub default_age { 20 }