Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Moose is lovely

by ysth (Canon)
on Feb 29, 2008 at 19:32 UTC ( [id://671269]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Moose is lovely
in thread Moose is lovely

Does it play well with lazy?

Replies are listed 'Best First'.
Re^5: Moose is lovely
by stvn (Monsignor) on Feb 29, 2008 at 20:02 UTC
    Does it play well with lazy?

    Yes, in fact the motivation for putting it in Class::MOP was to support the 'lazy_build' option in Moose (which is sort of documented in Moose::Meta::Attribute under "is_lazy_build", more docs to come, patches welcome and all that).

    In general if an option does not play well with another option, we consider it a "syntax" error and throw an exception at compile time.

    -stvn
Re^5: Moose is lovely
by nothingmuch (Priest) on Feb 29, 2008 at 20:09 UTC
    Wonderfully. There's even a shortcut for that: lazy_build => 1. It works like this:
    has foo => ( ... lazy_build => 1, ); sub _build_foo { my $self = shift; ... }
    -nuffin
    zz zZ Z Z #!perl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://671269]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-16 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found