読者です 読者をやめる 読者になる 読者になる

詩と創作・思索のひろば

ドキドキギュンギュンダイアリーです!!!

Released Class::Accessor::Lite::Lazy 0.03

Perl

Class-Accessor-Lite-Lazy-0.03 - Class::Accessor::Lite with lazy accessor feature - metacpan.org - Perl programming language

By default, the builder method name for an attribute $attr is named "_build_$attr". You can specify the builder method name/coderef using hashref.

use Class::Accessor::Lite::Lazy (
    ro_lazy => [
         'foo', # the buidler is assumed to be "_build_foo"
         { bar => '_mk_bar' },    # specify explicit builder method name
         { baz => \&_build_baz }, # or a coderef
    ],
);

If you specify all builders explicitly, you can use hashref instead of arrrayref.

use Class::Accessor::Lite::Lazy (
    ro_lazy => {
         foo => '_build_foo',
         bar => '_mk_bar',
         baz => \&_build_baz,
    },
);