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
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
> 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
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
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
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
> >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
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
> 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?
>