perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Moss <martin_m...@btopenworld.com>
Subject Re: RE: Re: object life
Date Wed, 01 Mar 2006 10:02:14 GMT

> I think part of the problem is the way I have
> configured the abstract
> class for Class::DBI. I don't know if there's
> another way of doing it,
> but I Have it read my config file for that
> particular instance to figure
> out paths and databases etc.

This is, in my opinion, a bad idea. Class::DBI (which
I haven't used, but have written and used something
simillar for years) I don't think is designed to be
used in this way.. 

I agree that you can do something to make this work,
but I feel sure you will just keep running into
problems with it... Much better to create two classes
site1::db; and site2:db; and have each class 'hard
wired' to load a specific config.. This would also
then give you the power in your code to do
site1::db->class_method  as well as
$db_inst->inst_method..... (if you haven't already
needed to call a subtroutine which returns properties
about the class before you instantiate it - I'm sure
you will sooner or later).... 

I seriously think you might want to consider
re-engineering. (if you've already written a huge
chunk of code, don't worry, sh*t happens.. It pays
dividends in the long run, and I'd be lying if I hadn'
had to do it myself several times over the years...)

Marty







> 
> I run the same framework on several machines where
> paths and databases
> are different, so the same framework instance on a
> different machine may
> actually have different values in the config file.
> Using the model you
> described doesn't lend itself to this.
> 
> Has anyone been using Class::DBI with multiple
> database instances?
> 
> Maybe I need to inherit the abstract class and
> create a connection
> whenever using the object. I guess I need to
> research that.
> 
> -d
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail:
> embperl-help@perl.apache.org
> 
> 



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message