Your wish is my command...
use v5.14; package Foo { use Moo; use MooseX::MungeHas 0.007 { hasro => ["is_ro"], hasrw => ["is_rw"] + }; hasro "foo"; hasrw "bar" => sub { "this is a very lazy builder" }; } my $f = Foo->new(foo => 1); say $f->foo; # "1" say $f->bar; # "this is a very lazy builder" $f->bar(2); # it's an rw attribute say $f->bar; # "2" $f->foo(2); # it's an ro attribute, dies
In reply to Re: Extra-lazy object oriented programming
by tobyink
in thread Extra-lazy object oriented programming
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |