Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Listing the functions of a package / methods of an object

by zentara (Archbishop)
on Jul 15, 2008 at 16:50 UTC ( [id://697760]=note: print w/replies, xml ) Need Help??


in reply to Listing the functions of a package / methods of an object

I use this often:
#!/usr/bin/perl use strict; use warnings; #by Abigail of perlmonks # example usage: $0 IO::File my $class = shift or die "need a class\n"; eval "use $class"; die $@ if $@; # First, find all the classes, and the ones it inherits. my %classes = ($class => 1); my @classes = ($class); while (@classes) { my $class = pop @classes; no strict 'refs'; foreach my $class (@{"$class\::ISA"}) { next if $classes {$class} ++; push @classes => $class; } } # Then find the subs in those classes. while (my $class = each %classes) { no strict 'refs'; print "From class '$class':\n"; while (my $entry = each %{"$class\::"}) { print "\t$entry\n" if defined &{"$class\::$entry"}; } } __END__

I'm not really a human, but I play one on earth CandyGram for Mongo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://697760]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found