Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 examining the Monastery: (16)
As of 2014-09-23 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls