develooper Front page | perl.beginners | Postings from March 2012

Access class symtab by dereferencing an object

Thread Next
From:
Steve Bertrand
Date:
March 3, 2012 10:51
Subject:
Access class symtab by dereferencing an object
Message ID:
4F526830.4060208@gmail.com
Hi all,

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

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

...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 }:: ){
     ...
}

Is there a proper way to do this that someone could point out?

Thanks,

Steve

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About