Re: Getting class of accessor
[prev]
[thread]
[next]
[Date index for 2005/02/05]
On Fri, Feb 04, 2005 at 06:27:31PM -0800, Peter Speltz wrote:
> package Class::Farm;
> __PACKAGE__->has_a ('toad' => "Class::Toad");
> __PACKAGE__->has_many ('mules' => "Class::Mule");
> Is there a one liner or sub in Class::DBI to get the class of toad or mules
> without knowing what relationship they are part of?
Not easily. Class::DBI doesn't always know what you're going to get
back. But in the simplest cases something like this might do:
my $meta = $class->meta_info;
my ($isa) = map $_->foreign_class, grep defined,
map $meta->{$_}->{$name}, keys %$meta;
Tony
|
|
Re: Getting class of accessor
Tony Bowden 11:15 on 05 Feb 2005
|