best practice for overriding read-write in child classes?

[email protected] ("John SJ Anderson")
Newsgroups perl.moose
Message-ID <[email protected]>
I've got a set of classes that all inherit from a common base. Among
the other things they share, they've got a common attribute called
'value'.

Some of these children need a setter for 'value'; others need to have
'value' be read-only. I had planned to override the read-write status
with:

    has '+value' => ( is => 'rw' );

but that's not allowed. 8^)

I can see a couple of ways to resolve this -- does anybody have input
on which is "best practice" as far as the Moose community is
concerned?

Option #1: Have the base class declare 'value' read-write, and
override the setter in the child classes that need to be read-only.

Option #2: Rejigger the object hierarchy to introduce 'ReadOnlyValue'
and 'ReadWriteValue' classes between the base class and the child
classes.

Option #3: ?

thanks,
john.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.