> On Aug 7, Martin A. Hansen said:
>
> >print &dump_functions( $obj );
>
> I'd think it's better for dump_functions() to return an array
> ref, and let the end-user decide how to use its contents.
>
> >sub dump_functions {
> > use Data::Dumper;
> > use Class::Inspector;
> >
> > my ( $obj ) = @_;
> >
> > my ( $ref, $methods, @methods );
>
> You never use @methods.
>
> > $ref = ref $obj;
> > $methods = Class::Inspector->methods( $ref, 'full', 'public' );
> >
> > @{ $methods } = grep /$ref/, @{ $methods };
> > return Dumper( $methods );
>
> That should probably be /^$ref/, for "safety". And I'd
> probably just do
>
> return [ grep /^$ref/, @{ Class::Inspector->methods(...) } ]
>
> >}
So would this return the methods that the $obj sent to dump_functions then, only
shorter?
sub dump_functions {
use Class::Inspector;
my $r = ref $_[0];
return [ grep /^$r/, @{ Class::Inspector->methods($r,'full','public')} ]
}
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]