I posted a question to CLPM on how to do this with perl5 and we decided to use an 'lvalue' attribute on the subroutine and then make the returned lvalue in the sub a tied variable to intercept read/writes:
http://groups.google.com/groups?th=5489106ee6715c8e
Note that this has already kinda been done:
http://search.cpan.org/~juerd/Attribute-Property-1.04/Property.pm
This only does setter-code (the getter always uses an element of the object) but it's perhaps interesting to look at.
It works, but its obviously slow
A::P uses the 'Want' module (if installed) to speed up the common cases.
-- Matthijs van Duin -- May the Forth be with you!