On 03/03/2012 01:51 PM, Steve Bertrand wrote:
Hi all,

I have a need to examine and manipulate certain aspects of a class
symbol table. I can do this:


you claim you have this need but given your skill level, i wonder if that is actually a real need. please state the larger problem you are trying to solve with this solution. likely there is a much easier and better way to do this.

manual introspection of a class doesn't make much sense. are you looking for a specific method? that is done with UNIVERSAL::can. are you looking for global variables? that isn't done much and so i doubt you need to do that.


...but what I'd like to do is dereference the object itself to get the
class, as there will be times I won't know what class an object belongs
to. Here is some pseudocode of what I'm trying unsuccessfully to achieve:

my $dog = Animal->new();
foreach my $entry ( keys %{ ref $dog }:: ){
...
}

that will get you every symbol (glob) in the class. you still would need to examine each glob to find a sub or variable or whatver. again, i say this is highly unlikely to be needed or what you really want.

uri

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to