I had try it, codes is here:

#!/usr/local/bin/perl -w

use Class::Inspector;
use IO::File;

my @methods = Class::Inspector->methods('IO::File', 'full', 'public');

print "@methods";

but it Only print this: ARRAY(0xaa4bc8)
Why?

于 2012-4-11 20:34, Shlomi Fish 写道:
Hi Zapp,

On Wed, 11 Apr 2012 16:12:22 +0800
Zapp<zapp.pref...@gmail.com>  wrote:

How Can I find all kinds of methods a Object support?
For example:

my $fh = IO::File->new("/path/to/file");

how manny kinds of methods does the $fh have ?

I try perldoc IO::File , but didn't find what I want.

See:

http://stackoverflow.com/questions/910430/how-do-i-list-available-methods-on-a-given-object-or-package-in-perl

The best answer there, in my humble opinion, is to use the Class::Inspector
CPAN module:

my @methods = Class::Inspector->methods( 'Foo::Class', 'full', 'public' );

Regards,

        Shlomi Fish


Reply via email to