If I understood you correctly, you want to see all the methods from a series
of .pm files, right? I see two ways to do this:
First, you could simply read the files manually, finding any lines that have
'sub' followed by a valid name (to avoid anonymous subroutines); since
methods are subs with an attitude. Untested:

perl -wln -E 'say $1 if /sub\s*(\w+)\s*{/' Your_PM_files_here

(Or you could pass a directory and let the script decide which files to
open.. or use File::Find, or File::Find::Rule, etc)

On the other hand, if you are loading them in your script via use or
require, it's possible to go through each of the module's symbol table,
checking which of the symbols are subs, then printing those. Here's a small
example of what I'm talking about; This shouldn't do what you want, and it
only checks one level of depth (should be not-too-hard to fix using a
recursive sub, or maybe simply an array that gets package names pushed into
it), but it's a nice starting point (although do be mindful that it's not
really good Perl..). Well, maybe.

perl -E 'for (sort keys %main::){ chomp; next unless /\w+::/; my $package =
$_; for (sort keys %{$package}){ say if defined &{"$package$_"} } }'


Brian.

Reply via email to