Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Introducing Class::InsideOut

by phaylon (Curate)
on Jan 10, 2006 at 14:51 UTC ( [id://522193]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://522193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found