It depends how the object is implemented (which is, of
course, something that, as a user of the object, you
shouldn't be interested in).
Assuming that the object is a blessed hash, then you
can get to all of its properties using standard hash
lookup techniques.
my $obj = SomeObject->new;
foreach (keys %$obj) {
print "$_ : $obj->{$_}\n";
}
Of course, some of the properties may be complex data
structures that you'd need to unravel yourself. You might
be better off just using Data::Dumper.
As for methods, you can get a list of the defined
methods by examining the object packages symbol table
(the Devel::Symdump module is useful for this), but bear in
mind that not all methods may be defined. A common trick
is to use AUTOLOAD to simulate accessor methods.
Or perhaps you should just read the published interface
for the object :)
--
<http://www.dave.org.uk>
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
|