Re: Dependency Injection

2005-07-08 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > On Wed, Jul 06, 2005 at 11:47:47PM +0100, Piers Cawley wrote: > : Or you could use a global, but globals are bad... > > Globals are bad only if you use them to hold non-global values. > In this case it seems as though you're just going through contortions >

Re: Dependency Injection

2005-07-06 Thread Larry Wall
On Wed, Jul 06, 2005 at 11:47:47PM +0100, Piers Cawley wrote: : Or you could use a global, but globals are bad... Globals are bad only if you use them to hold non-global values. In this case it seems as though you're just going through contortions to hide the fact that you're trying to do somethin

Re: Dependency Injection

2005-07-06 Thread Sam Vilain
Piers Cawley wrote: Then the harness that actually sets up the application would simply do use Logger::DBI :dsn<...>, :user<...>, :password<> and Logger::DBI would install itself as the default Logger class. The question is, how does one write Injected to make this work? Or what features

Dependency Injection

2005-07-06 Thread Piers Cawley
So, I got to thinking about stuff. One of the more annoying things about writing nicely decoupled objects and applications are those occasions where you want an object to be able to create objects in another class. Say you've provided a singleton interface to your logging system. The naive implemen