[CDBI] Worknig on Class::DBI::Relationship::IsA

Peter Speltz peterspeltz at gmail.com
Wed Feb 22 18:04:42 GMT 2006

Hi all. I am co maintaining CDBI::Rel::IsA with Teejay.   I'm
currently working on it to upload a version today.  I'm a month or two
behind but expect that. I have a couple questions.

1) How to Handle  CDBI Frozen vs Not Frozen versions.  I am thinking
that *EVEN* versions numbers on IsA will be compatible with the CDBI
Frozen and Odd numbers with later releases.   ?  Is this a good or bad
idea? Any better ideas?

2) One to One vs Many to One.  -- from my DB  knowledge  I understand
IsA rels to be of either 1:1 or M:1 relationship types.  I want to
make IsA cascade delete if it is a 1:1.  I'm thinking of doing that by
passing an extra arg to the isa call:

Music::Artist->is_a(person => 'Music::Person', {one_to_one     => 1} );
Music::Person->is_a(species => 'HomoSapien', {many_to_one => 1} ); # fancy has_a

Any objections to this interface? Better ideas?

3) Are the docs still wrong on usage ? I find that I have to declare
which column to "import" from the IsA class in my classes column
lists. This may be a good thing as you have some control over methods
created for you. The docs say :

  Music::Artist->columns(All => qw/artistid alias/);
  Music::Artist->is_a(person => 'Music::Person'); # Music::Artist
inherits Person accessors

But my experience is this:

  Music::Artist->columns(All => qw/artistid alias first_name  last_name dob/);

  Music::Artist->is_a(person => 'Music::Person'); # Music::Artist only
inherits Person first_name,
last_name, and dob

An official test will take care of what is and is not.  I would like to know --
What is desired?  Personally I am leaning toward being abel to declare
which are inherited.  It could be an arg that defaults to all.

 Also, maybe the issue is that the accessor is created but it does not
get put in the "All" colums list and it is causing me problems.
Music::Artist->is_a(person => 'Music::Person', { inherit =>
[first_name, ...] });


What I have done --
I currently have my version patched to cascade delete (i just use
has_a for M:1). I also have it patched for later CDBI releases.  I
also have the annoying debugging warns wrapped in conditionals and
defaulting to Off.

I do *not*  have official tests. I have used it pretty heaavily in
developement though without apparent issues.

So , later today   I will be uploading  .06 which will:

1) Not annoy you with warnings
2) Have Correct synopsis*
3) Have cascade delete for one_to_ones *
4) Be compatible with CDBI Frozen

And .07 all above except 4. It will be compatible with current release.

* Pending further discussion

thanks for any help.


More information about the ClassDBI mailing list