* Ken Miller ([EMAIL PROTECTED]) [000515 17:16]:
> In the content serving phase I have a Database services object which
> manages all access to/from the database.  The DB::Services object is
> created the first time the handler is hit; the $dbs is made available by
> creating a symtab entry, so all my Mason components can get at the database
> easily.
> 
> ...snip...
>
> I guess another way of doing it would be to turn the $dbs class into a
> Singleton, and provide a class method to get at the instance:
> 
> DB::Services->set_uri( 'dbi:Oracle:XXXX' );
> DB::Services->set_userid( 'foo' );
> DB::Services->set_password( 'bar' );
> DB::Services->set_options( { ... } );
> 
> my $dbs = DB::Services->get_instance;
> 
> get_instance() would create the backing object the first time, then
> returned the cached object on subsequent calls.

I use Class::Singleton in mod_perl apps with *no* problem
whatsoever. In fact, it's pretty nifty to simply say:

 my $obj = $class->instance;

anywhere in my application and have the object (whatever it is) simply
pop up.

Good luck!

Chris

-- 
Chris Winters
Internet Developer    INTES Networking
[EMAIL PROTECTED]    http://www.intes.net/
Integrated hardware/software solutions to make the Internet work for you.

Reply via email to