Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Tim McDaniel
April 9, 2009, 12:09 am
rate this thread
Does anyone have examples of code that
- provides a class attribute via MooseX::ClassAttribute
- that class attribute is readable but not changable by the outside
- that class attribute can be changed within the package itself?
In my case, I have a class of objects that each have an integer key
(set once at new() time, never changed thereafter). I'd like to
provide to the user of the class a way to get the minimum key so far
and the maximum key so far, but I don't want them to be able to change
it. Within the package, though, I need to conditionally update max
and min at every object creation (currently, I'm using "sub BUILD" to
catch the event).
I have a basic notion of how to do it outside Moose, but I'd like to
do it "the usual Moose|MooseX way", especially as they may handle
grungy details that I know nothing about, such as correct inheritance.
Tim McDaniel, email@example.com
- » FAQ 4.28 How do I change the Nth occurrence of something?
- — Next thread in » PERL Discussions
- » Re: Modification of a hash-by-reference parameter in a recursive sub
- — Previous thread in » PERL Discussions