Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Moose and BUILD and 'ro' attributes

by stvn (Monsignor)
on Dec 15, 2010 at 15:44 UTC ( #877292=note: print w/ replies, xml ) Need Help??

in reply to Moose and BUILD and 'ro' attributes

How do I set read-only variables in BUILD?

Why not just make a private writer, like this

has 'foo' => ( is => 'ro', isa => 'Something', writer => '_set_foo', lazy => 1, build => '_build_foo', );

Which is called first, BUILD or the attribute_builders?

The entire object instance is created and finalized before BUILD is called. When it gets to BUILD you can be sure you have a complete object (minus any non-initialized lazy attrs, etc).


Comment on Re: Moose and BUILD and 'ro' attributes
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-10-10 05:45 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (254 votes), past polls