Hi,

A quick question on recommended practice here.

One of my Moose-using package attributes is a hash reference.

What's the recommended accessor technique for a key in that hash if
I want a dedicated accessor/mutator for that key? a dedicated method?
or something Moose-y?

Provisos:

a) I want several such accessors so cut-n-paste for a dedicated method
is unattractive

b) I do need the whole hash reference so it's not an option to hide
it completely.

$obj->hashrefattr({ foo => bar, joe => blow });

I then want to be able to write

$obj->foo and $obj->joe('bloggs');

for reasons of brevity and readability.

Obviously it's trivial to use $obj->hashrefattr->{foo}, but
I'd like a dedicated accessor/mutator method for that key.

- Mark


Reply via email to