The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

Mo::default - Adds the default feature to Mo's has

Synopsis

    use Mo qw'default';
    has name => ( default => sub { 'Joe' } );

Description

Adds the default parameter to has, which expects a code reference, returning a value to be used to set the attribute to if it hasn't been set yet.

Currently this is always called lazily.