On Thu, Feb 5, 2009 at 9:32 AM, Dave Rolsky <auta...@urth.org> wrote: > This is not right. There's a much simpler way, and it doesn't require > digging into the object's hashref, which is strongly discourage with Moose. > > package Foo; > > has 'list' => > ( is => 'rw', > isa => 'ArrayRef', > lazy => 1, > default => sub { [] }, > clearer => '_clear_list', > ); > > my $foo = Foo->new(); > > $foo->list(); # makes a new arrayref and returns it > $foo->_clear_list; > $foo->list(); # makes a new arrayref and returns it, again
Hmm. But you still have to write _clear_list(), yes? > > I do second the recommendation to take a look at MX::AttributeHelpers, > though. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/ > -- Matthew O. Persico