[CDBI] IsA wiping out the my base search

Peter Speltz peterspeltz at gmail.com
Mon Oct 31 14:54:56 GMT 2005


---------- Forwarded message ----------
From: Peter Speltz <peterspeltz at gmail.com>
Date: Oct 31, 2005 8:54 AM
Subject: Re: [CDBI] IsA wiping out the my base search
To: "Randal L. Schwartz" <merlyn at stonehenge.com>


On 31 Oct 2005 06:01:10 -0800, Randal L. Schwartz <merlyn at stonehenge.com> wrote:
>
>     SubClass ->search  () # calls base search
>
>     SubClass->SUPER::search  ( ) # calls IsA search
>
> SUPER:: is tied to __PACKAGE__.  Something like this will work
> if you're in a {package SubClass; ... } area, but not in general.
>
> What are you actually trying to accomplish?
>

I am using Maypole::Model::CDBI as my base class.   It has an action
method named "search".  This mehod  really has nothing to do with the
CDBI's  search (constructor)  except that it calls it within it to
well do the search  and that CDBI is a base class to it so it
overrides it in a sense.

So what I have for class structure:

            Subclass
        MaypoleCDBI
         Class::DBI

SubClass IsA SubClass2.  .    IsA wants to override CDBI's standard
search to do a join search on the two tables (SubClass and SubClass2
tables).  It does this by  injectin   a  "search" method into the
SubClass package.  However this is not the ideal place in the
inheritance structure for it. It should be betwenn  MaypoleCDBI and
Class:;DBI .

Make sense?  I am starting to see the lunacy in this.   But it seems
like a reasonable expectation though.   Maybe it needs to do a trick
like Maypole::Model:;CDBI does at the beginning:

return shift->SUPER::search(@_) if caller ne "Maypole::Model::Base";

except with the appropriate clauses:

return SubClass->original_search if we are not wanting to do  a  CDBI search .


thanks


--
pjs




More information about the ClassDBI mailing list