Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > MooseX::ClassAttribute: read-only outside, writable inside

Thread Tools

MooseX::ClassAttribute: read-only outside, writable inside

Tim McDaniel
Posts: n/a
I'm very new to Moose, and I'm probably missing something very simple.

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, Removed)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make checkbox writable on Gridview initializatio? hazz ASP .Net 0 04-28-2006 10:57 PM
Create a writable folder in aspnet setup project roger ASP .Net 2 10-23-2004 05:50 AM
Re: System.ArgumentException: Stream was not writable? Craig Deelsnyder ASP .Net 1 07-19-2004 07:39 PM
Dragging Files to writable CDs Robert Computer Support 1 01-28-2004 07:45 PM
Quality of writable DVDs? Gaikokujin Kyofusho DVD Video 3 09-07-2003 10:38 PM