[CDBI] issue with using cdbi::sweet with cdbi::relationship::isa

Rhesa Rozendaal perl at rhesa.com
Mon Feb 6 23:32:09 GMT 2006


I have an app where I use cdbi::sweet as base. One of my classes uses 
cdbi::relationship::isa, and I found out that retrieve() doesn't work on that 

I tracked this down to the use of a hard-coded reference to Class::DBI::search 
in cdbir::isa. There are other occurences of hard-coded references to methods 
in Class::DBI, so those are broken in this combination as well.

While I'm fine with locally modifying my version of cdbir::isa to using Sweet 
instead, I'd like to see if there's a better way to find the correct original 
search() method.

I have the following in cdbir::isa (at line 160):

     my $old_search = UNIVERSAL::can($self->SUPER::class, 'search');
     *{$self->class."::orig_search"} = $old_search;
				# \&{"Class::DBI::Sweet::search"};

While that lookup of $old_search works in my particular class hierarchy, I 
don't feel it's adequate for general consumption. But I don't know enough 
about the innards of cdbi (or ::sweet) to tell for sure.

Can anyone suggest a better approach to finding the correct original search() 


PS. I have an older 0.05 version of Class::DBI::Relationship::IsA, because the 
one currently on CPAN is riddled with annoying warn() statements, among other 
fragile code.
I really like the idea of IsA, but it's rather immature. Unfortunately I lack 
the means to properly improve it (much like the maintainer, it seems). Any 
help towards improving IsA is highly appreciated!

More information about the ClassDBI mailing list