in reply to How to get list of methods inside object

You can do this with Devel::Symdump:

#!/usr/bin/perl -l use strict; use warnings; use Devel::Symdump; my $dump = Devel::Symdump->new('Foo'); print for $dump->functions; package Foo; sub new { bless {}, shift } sub foo {} sub bar {} sub baz {} sub qux {}

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: How to get list of methods inside object
by ikegami (Patriarch) on Oct 11, 2005 at 14:07 UTC
    caveats: That will list all functions in the package, not just methods, but Perl can't tell the difference. Also, it won't list inherited methods unless the package overrides them.
      Two more things:
      • Package-table checks have no chance with AUTOLOAD
      • Walking the @ISA tree is tenuous at best, due to putting subrefs into @ISA.

      Update: Oops! I wasn't supposed to tell you - that was your Christmas gift. :-(


      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
        Walking the @ISA tree is tenuous at best, due to putting subrefs into @ISA.
        Huh? New feature sneak by me? When was it added? Or are you misremembering coderefs in @INC (for cool require/use interceptions)?

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.

Re^2: How to get list of methods inside object
by japhy (Canon) on Oct 11, 2005 at 14:06 UTC
    He'll probably want rnew('Foo'), which uses recursion (which I assume means it would check Foo's ISA tree).

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart