>>>>> "Juan" == Juan Ladetto <[email protected]> writes:

Juan>     has 'lazy'        => (is => 'ro', isa =>"Bool", 
Juan>                                     lazy =>1, 
Juan>                                     default => 
Juan>                                         sub
Juan>                                         {
Juan>                                             return 1;                     
                                                         
Juan>                                         });

By the way, I'm a big fan of lazy_build => 1, because it lets me put the
builder in a separate named method, and gives me the tester and clearer for
free:

    has lazy => is => 'ro', lazy_build => 1;
    method _build_lazy {
           return $self->otherattr + 3;
    };

Presuming you're using MooseX::Declare syntax, and if you aren't, try it!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to