in reply to Introducing Class::InsideOut

I really like the approach. And my first thought was 'Additional functionality could be injected with Traits.' Is there a possibility of introspecting the class? Such as retrieving "registered" properties?

Ordinary morality is for ordinary people. -- Aleister Crowley

Replies are listed 'Best First'.
Re^2: Introducing Class::InsideOut
by xdg (Monsignor) on Jan 10, 2006 at 21:28 UTC

    Yes, traits should integrate into this well, at least conceptually. (I'll have to review Class::Trait more closely before commenting on any potential compatibility with that specific implementation.)

    Some introspections should be possible, but the property names aren't directly available at the moment -- only references are saved away. However, if accessors are created, those methods would define what is available to a trait. (Traits would be in a different lexical scope and would have to use accessors.)

    Getting the property names for accessors is actually a bit tricky and would involve either ugly syntax (property name => my %name) or else using something like PadWalker to find the name from the reference. I haven't worked out an elegant/portable approach yet.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.