On Thu, Apr 12, 2012 at 06:29:09PM +0800, Zapp wrote: > 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?
The documentation for Class::Inspector says: methods $class, @options For a given class name, the "methods" static method will returns ALL the methods available to that class. This includes all methods available from every class up the class' @ISA tree. >>> Returns a reference to an array of the names of all the available >>> methods on success, or "undef" if the class name is invalid or >>> the class is not loaded. So you need to assign the return of Class::Inspector->methods to a scalar and later defererence the reference. You could make these changes: my $methods = Class::Inspector->methods('IO::File', 'full', 'public'); print @$methods; # consider print join $/, @$methods; and you'll get a list of methods. -- Michael Rasmussen, Portland Oregon Other Adventures: http://www.jamhome.us/ or http://westy.saunter.us/ Fortune Cookie Fortune du courrier: "Frobyshnobskurov?", I asked them, looking pleading. I think I was asking for drain cleaner but they cottoned on when I dabbed my finger on the map.Frobyshnobskurov, it said, plain as life. "Ah," said a warty one, finally understanding, "Frropbussplanshikoo-ROFF!" Hungarian is like that. ~ Cross country bike tourist Leo Woodland -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/