Re: getting all method names

[prev] [thread] [next] [Date index for 2005/04/05]

From: Kingsley Kerce
Subject: Re: getting all method names
Date: 04:50 on 05 Apr 2005
Marc Lambrichs writes:
 > Dana Hudes wrote:
 > >use Data::Dumper;
 > >print Dumper($class);
 > >
 > >On Tue, 5 Apr 2005 mlambrichs@xxxxxxxxxx.xx wrote:
 > >>How can I get a list of all possible attributes/methods of a cdbi class?
 > >>
 > >>Cheers,
 > >>Marc
 > >>
 > Mmmh. Not really what I want. I would like to write a generic data 
 > transfer object (look for it in [Alur2003] and [Fowler2003]) that uses a 
 > list of all possible methods:
 > 
 > my $object = Model::Object->retrieve( $id );
 > foreach (my $object->methods){
 >     do_something( eval $object->$_ );
 > }

use Devel::Symdump;
my $object = Model::Object->retrieve( $id );
foreach (Devel::Symdump->new('Model::Object')->functions){
    s/^Model::Object:://;
    do_something( eval $object->$_ );
}

Kings

getting all method names
mlambrichs 04:03 on 05 Apr 2005

Re: getting all method names
Dana Hudes 04:09 on 05 Apr 2005

Re: getting all method names
Marc Lambrichs 04:27 on 05 Apr 2005

Re: getting all method names
Dana Hudes 04:32 on 05 Apr 2005

Re: getting all method names
Kingsley Kerce 04:50 on 05 Apr 2005

Re: getting all method names
William Ross 08:26 on 05 Apr 2005

Generated at 09:29 on 27 Apr 2005 by mariachi v0.52