Perl Monk, Perl Meditation | |
PerlMonks |
Moose rolesby dk (Chaplain) |
on Jan 13, 2010 at 14:39 UTC ( [id://817190]=perlquestion: print w/replies, xml ) | Need Help?? |
dk has asked for the wisdom of the Perl Monks concerning the following question:
Kind monks, I'd like to ask some help with my problem with Moose. I'd like to create a trait, or even better an overloaded type that does special stuff with "around" accessor. Normally, one writes
I'd like to shorten that into
or even better, to
possibly making MyAccessor a separate MooseX module. However, even with help of #moose I couldn't go far, and, also because IRC is not the best way of exchanging large pieces of code, I'd like to ask if you could help me here. I stopped here:
I thought that I should manipulate $meta, but I'm unsure how. Any ideas? Thank you! Update: as usual, I've asked how to do X when I wanted Y. My apologies. Actually, I'd like to use array and hash attributes in mixed list and array contexts:
I though I could do that with "around", which prompted the original question
Update #2: Problem solved. Proof of concept is on CPAN
Back to
Seekers of Perl Wisdom
|
|