Class::DBI::Loader and the CDBI inheritance hierarchy
[prev]
[thread]
[next]
[Date index for 2005/03/18]
Consider the familiar CD schema in the SYNOPSIS of the Class::DBI POD.
Focusing on the Music::Artist class, and supposing we include a
retrieve_all method in our "top level" class Music::DBI to override
Class::DBI's retrieve_all method, we end up with the following
inheritance hierarchy.
(note: ASCII art ahead -- view in fixed-width font)
Class::DBI
retrieve_all
|
|
Music::DBI
retrieve_all
|
|
Music::Artist
As expected, invoking Music::Artist->retrieve_all will execute the
Music::DBI retrieve_all method.
Now, if we instead use Class::DBI::Loader (a relatively recent
version) to set up the Music::Artist class, and -- just for purposes
of being specific in this example -- suppose we use an SQLite
datasource, we end up with a different inheritance hierarchy.
In particular, Music::Artist has had Class::DBI::SQLite included in
its @ISA (see the Class-DBI-Loader-0.17 distribution, file
Class/DBI/Loader/Generic.pm, line 179, for when this occurs).
Class::DBI
/ retrieve_all
/ \
/ \
Class::DBI::SQLite Music::DBI
retrieve_all
\ /
\ /
\ /
Music::Artist
In this case, invoking Music::Artist->retrieve_all will execute the
Class::DBI retrieve_all method. This seems to not be a good thing.
Am I missing something here? Is it really necessary for CDBIL to muck
with @Music::Artist::ISA?
Thanks,
Kings
|
Class::DBI::Loader and the CDBI inheritance hierarchy
Kingsley Kerce 04:04 on 18 Mar 2005
|