Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: rebuilding lazy Moose attributes

by tobyink (Abbot)
on Aug 20, 2013 at 21:48 UTC ( #1050250=note: print w/ replies, xml ) Need Help??


in reply to rebuilding lazy Moose attributes

I tend to use 'ro' attributes as much as possible and thus avoid things like this.

I have a module Trait::Attribute::Derived that offers a bunch of sugar for deriving one attribute from another, but it doesn't offer this feature. Perhaps it should?

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: rebuilding lazy Moose attributes

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-08-29 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls