SOLVED: how do i list the methods connected to a object?

2003-08-14 Thread Martin A. Hansen
problem solved: given an arbitrary object, i can now get a dump of all the functions connected to the object. print &dump_functions( $obj ); sub dump_functions { use Data::Dumper; use Class::Inspector; my ( $obj ) = @_; my ( $ref, $methods, @methods ); $ref = ref $obj

RE: SOLVED: how do i list the methods connected to a object?

2003-08-07 Thread Perry, Alan
On Thursday, August 07, 2003 11:28, Dan Muey wrote: >>>sub dump_functions { >>>use Class::Inspector; >>>my $r = ref $_[0]; >>>return [ grep /^$r/, @{ >>>Class::Inspector->methods($r,'full','public')} ] } >> >> Yeah. The 'return' keyword can even be left out. > >Nice! I'll leave it i

RE: SOLVED: how do i list the methods connected to a object?

2003-08-08 Thread Dan Muey
> 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 ( $o

Re: SOLVED: how do i list the methods connected to a object?

2003-08-11 Thread Martin A. Hansen
On Thu, Aug 07, 2003 at 09:01:57AM -0500, Dan Muey wrote: > > Cool! 1 quick question why do you have @methods? sorry old remnant. just delete. martin > If it's because you use @{ $methods } then $methods would have to be the string > 'methods' to be a reference to @methods, which doesn't have

RE: SOLVED: how do i list the methods connected to a object?

2003-08-14 Thread Jeff 'japhy' Pinyan
On Aug 7, Dan Muey said: >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')} ] >} Yeah. The 'return' keyw

RE: SOLVED: how do i list the methods connected to a object?

2003-08-14 Thread Dan Muey
Cool! 1 quick question why do you have @methods? If it's because you use @{ $methods } then $methods would have to be the string 'methods' to be a reference to @methods, which doesn't have any data as far as I can tell. Maybe I'm missing something? Dan > problem solved: > > given an arbitrar

RE: SOLVED: how do i list the methods connected to a object?

2003-08-14 Thread Dan Muey
> >sub dump_functions { > >use Class::Inspector; > >my $r = ref $_[0]; > >return [ grep /^$r/, @{ > >Class::Inspector->methods($r,'full','public')} ] } > > Yeah. The 'return' keyword can even be left out. Nice! I'll leave it in for readability I think. Wouldn't it need a ';' at t

Re: SOLVED: how do i list the methods connected to a object?

2003-08-14 Thread Jeff 'japhy' Pinyan
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 ( $r

RE: SOLVED: how do i list the methods connected to a object?

2003-08-14 Thread Dan Muey
> On Thu, Aug 07, 2003 at 11:28:10AM -0500, Dan Muey wrote: > >> Yeah. The 'return' keyword can even be left out. > > > > Nice! I'll leave it in for readability I think. > > > > Wouldn't it need a ';' at the end? > > [ grep .. ]; > > > > Or am I once again missing something I should know? >