in reply to Symbol table globbing from object refs

This should give you a list of all functions available to a given object
use Class::ISA; use Devel::Symdump; ## you may want to use Scalar::Util's blessed() my $pkg = ref $obj; Devel::Symdump->functions( Class::ISA::super_path($pkg), $pkg );
See. Class::ISA and Devel::Symdump for more info.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Symbol table globbing from object refs
by QM (Parson) on Nov 29, 2003 at 17:39 UTC
    This should give you a list of all functions available to a given object
    I think some Autoloaded functions (such as accessors) may be missed, unless they have been used before. I played with this idea from Conway's book Object Oriented Perl, p91, pp114-7 a few years ago.

    However, a user-centered design should document the public ones, and make their names available through some mechanism. What that mechanism should be, I'm not certain. I only raise the point to ask if this hole has a cover.

    Update: I meant to ask "What is the convention for objects to communicate their method names to the outside world, given that Autoload may be employed?"

    Update 2: Page numbers added.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      I think some Autoloaded functions (such as accessors) may be missed
      Indeed, since an AUTOLOADed subroutine can be almost anything they're more or less impossible to test for. But this is also basically the same situation for any run-time generated subroutines, so any attempts at getting all available methods naively can only be so effective.
      HTH

      _________
      broquaint

      Ideally all AUTOLOADable methods will be declared:
      sub mymethod1; sub mymethod2; ...
      In practice, its not always done.