[Chicago-talk] Asking an class for its method list

Ed Summers ehs at pobox.com
Sun Jan 25 16:59:00 CST 2004


On Sun, Jan 25, 2004 at 04:50:39PM -0600, Jay Strauss wrote:
> How can I get back a list of methods available in an class?

Without getting down and dirty with namespaces, you can install 
the lovely Module::Info:

    use Module::Info;
    my $module = Module::Info->new_from_module( 'CGI' );

    my %subroutines = $module->subroutines();
    
    foreach $subroutine ( keys( %subroutines ) ) { 
        print "$subroutine\n";
    }

//Ed
    



More information about the Chicago-talk mailing list