詩と創作・思索のひろば

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

Fork me on GitHub

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

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,
    },
);

はてなで一緒に働きませんか?