RE: dynamically defining base class for a CDBI table module

[prev] [thread] [next] [Date index for 2005/03/10]

From: Gianni, Andrew
Subject: RE: dynamically defining base class for a CDBI table module
Date: 21:35 on 10 Mar 2005
Never mind, I think I figured it out. It's pretty simple actually; I
just need to update the ISA array for each table module that I import to
point to the module that contains the db_Main that I want to use. For
example, I might to this:

package Project

require Schema1::Table1;
require Schema1::Table2;
require Schema2::Table1;
require Schema2::Table2;

Each module sub-classes from its parent, so Schema1::Table1 and
Schema1::Table2 do a use base on Schema1. This is helpful if I'm just
working within that schema. The problem I was having was that I wanted
all of these table modules to actually inherit from a single parent with
a single db_Main method for this project. To do this I can:

@Schema1::Table1::ISA =3D qw(Project::CDBI);

assuming Project::CDBI defined a db_Main method. I can then just put the
whole thing in a foreach loop, performing the requires and ISA
definitions.

Andrew

RE: dynamically defining base class for a CDBI table module
Gianni, Andrew 21:35 on 10 Mar 2005

Generated at 08:54 on 14 Mar 2005 by mariachi v0.52