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.

Reply via email to