Re: domain cross talk...?

[prev] [thread] [next] [Date index for 2004/10/06]

From: Carl Johnstone
Subject: Re: domain cross talk...?
Date: 23:17 on 06 Oct 2004
Sorry replied to Michael with this first time round, when I meant to send it
to the list:

> package Table::Users;
>
> use base 'Site2::ClassDBI';
[snip]
> package Table::Users;
>
> use base 'Site3::ClassDBI';
[snip]
> Is doing it this way a problem?

Yes you're using the same namespace for what are in effect two different
classes. You'll never know which base class the particular Table::Users
you're using is from.

If you're really copying/pasting and amending code, you should definately
use separate packages - Site2::Users and Site3::Users I'd suggest!

Now, here's a thought - somebody else may be able to answer - could you use
multi-inheritance in conjunction with CDBI. Say specific Cust::ClassDBI
modules, alongside a common MyApp::Users table containing all your User
handling code. Then a specific Cust::Users module which pulls them in. In
code:


package Cust1::ClassDBI;
use base 'Class::DBI';
__PACKAGE__->set_db('Main',cust1_db,'user1','pass1');

package Cust2::ClassDBI;
use base 'Class::DBI';
__PACKAGE__->set_db('Main',cust2_db,'user2','pass2');

package MyApp::Users;
#no use base in here because we don't know what it'll be
__PACKAGE__->table('users');

__PACKAGE__->columns(Primary => qw/userid/);
__PACKAGE__->columns(Others => qw/username password/);

package Cust1::ClassDBI;
use base qw(Cust1::ClassDBI MyApp::Users);

package Cust2::ClassDBI;
use base qw(Cust2::ClassDBI MyApp::Users);



Carl

(message missing)

domain cross talk...?
Michael Jensen 06:47 on 06 Oct 2004

Re: domain cross talk...?
William McKee 14:41 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 14:47 on 06 Oct 2004

Re: domain cross talk...?
William McKee 14:51 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 15:06 on 06 Oct 2004

Re: domain cross talk...?
William McKee 15:32 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 15:36 on 06 Oct 2004

Re: domain cross talk...?
Michael Jensen 16:03 on 06 Oct 2004

Re: domain cross talk...?
Michael Jensen 16:16 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 16:27 on 06 Oct 2004

Re: domain cross talk...?
Carl Johnstone 23:17 on 06 Oct 2004

Re: domain cross talk...?
William McKee 15:53 on 06 Oct 2004

Re: domain cross talk...?
merlyn (Randal L. Schwartz) 16:17 on 06 Oct 2004

Re: domain cross talk...?
Perrin Harkins 16:31 on 06 Oct 2004

[CDBI] Class::DBI::Loader question
Peter Speltz 00:31 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 02:57 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Perrin Harkins 04:12 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 18:43 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Clayton L. Scott 17:08 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Peter Speltz 17:32 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Perrin Harkins 18:58 on 12 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 14:26 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Perrin Harkins 15:17 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Tony Bowden 15:39 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Kingsley Kerce 14:26 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
Tim Bunce 16:22 on 14 Oct 2004

Re: [CDBI] Class::DBI::Loader question
merlyn (Randal L. Schwartz) 17:24 on 14 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52