[Dbix-class] Re: Resultset classes and auto-loading

Brandon Black blblack at gmail.com
Thu May 10 12:34:19 GMT 2007


On 5/8/07, Christopher H. Laco <claco at chrislaco.com> wrote:
> > For the sake of me not forgetting this later...
> > CAG would use 'inherited' as the storage for component classes...
> >
> > This leads me to believe that get/set_inherited are wrong when used in
> > DBIC because CAG uses standard ISA, and everything in DBIC is C3.
> >
> > Assuming that's correct, I'll take a crack ad a CAG::C3...which in
> > theory is simply the same as CAG with get_super_paths overridden to use
> > caculateMRO()....
> >
> > ?
>
> Or, am I overthinking this. C3 just changes the ISA orders right? So, if
> it's done by the time I need to surf ISA...does it matter?
>

It does matter.  get_super_path implicitly uses depth-first-search
instead of C3.  The "right" answer in 5.9.5+ is to use
mro::get_linear_isa($class), which honors C3 ordering when
appropriate.  The mro.pm in 5.9.5 was intentionally given a 1.x
version number so that I could then public 0.x versions on CPAN to
offer some backwards-compat-ish interfaces.  In CPAN mro.pm,
get_linear_isa could be implemented by looking at whether
$Class::C3::MRO exists and the class is defined there, etc.

So I guess what I'm saying is that CAG and other modules that like to
walk the @ISA tree manually should be doing "use mro; my
@ordered_classes_to_search = mro::get_linear_isa($class)", but I
haven't gotten around to publishing mro.pm on CPAN for pre5.9.5 perls.

-- Brandon



More information about the Dbix-class mailing list