On Tuesday 13 Apr 2010 10:17:13 CHAN, KENNETH 1 [AG/7721] wrote:
> Hi all,
> 
>   I wanted to display the actual values in an array by the following
> simple codes:
> 
> *********************************
> 

Always add "use strict;" and "use warnings;" (and correct all reported 
problems). Not that it should matter here.

> use Class::Inspector;
> 
> use Bio::Graphics;
> 
> 
> 
> my @methods = Class::Inspector->methods( 'Bio::Graphics', 'full',
> 'public');
> 
> foreach (@methods) {
> 
>     print $_ . "\n";
> 
> }
> 
> *********************************
> 
> However, it only prints: ARRAY (0x18833dc)
> 

1. I guess ->methods returns a single array reference instead of a flattened 
list even in scalar context. So you should do:

{{{
my $methods = Class::Inspector->methods( 'Bio::Graphics', 'full', 'public');

foreach my $method (@$methods) {
        # Do something with $method.
}
}}}

2. Next time you can use Data::Dumper or perl -d's x command to inspect nested 
data structures.

Regards,

        Shlomi Fish

> How can I print out all the actual method name?
> 
> Thanks in advance.
> 
> 
> 
> Regards,
> 
> Kenneth
> 

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Rethinking CPAN - http://shlom.in/rethinking-cpan

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to