Two items:
1. I was just surprised to discover that Moose::Role does not allow augmenting
attributes.
I was hoping to specify in the Role that an attribute was required, and most of
the characteristics of the attribute. In the class that uses the role, it
would augment the attribute to specify the actual value (with default).
However, I get a complaint about a required attribute needing a default,
handler, etc. when I do the "with Role", before I get a chance to augment the
attribute with its value.
I wanted the required to be specified in the role to ensure that any class that
uses the role actually provided the default value (but didn't need to do
anything else to describe the attribute).
Is there an alternate approach for this?
2. Is there a way of allowing a ref as a default value? I'm setting up a class
attribute - a 'ro' reference to a list of hashes, that the super-class will
access (using the subclasses list to drive the actions specific to the subclass
without requiring new code in each sub-class). I know I can use default => sub
{ \$table } but I was hoping that there was some sort of flag I could use to
say that I really did want to have a common ref value shared by all objects of
this class.
--------------------------------------------------------------------------
NOTICE: If you have received this communication in error, please destroy all
electronic and paper copies and notify the sender immediately. Mistransmission
is not intended to waive confidentiality or privilege. Morgan Stanley reserves
the right, to the extent permitted under applicable law, to monitor electronic
communications. This message is subject to terms available at the following
link: http://www.morganstanley.com/disclaimers. If you cannot access these
links, please notify us by reply message and we will send the contents to you.
By messaging with Morgan Stanley you consent to the foregoing.