Re: getting all method names
[prev]
[thread]
[next]
[Date index for 2005/04/05]
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