Return-Path: Delivered-To: apmail-modperl-archive@apache.org Received: (qmail 8070 invoked by uid 500); 2 Oct 2002 20:48:45 -0000 Mailing-List: contact modperl-help@apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 8046 invoked from network); 2 Oct 2002 20:48:44 -0000 Date: Wed, 2 Oct 2002 15:48:48 -0500 (CDT) From: Dave Rolsky To: william ross cc: modperl@perl.apache.org Subject: Re: passing an object to a handler In-Reply-To: <5D33C3AA-D646-11D6-83CE-0003938AF80E@spanner.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Wed, 2 Oct 2002, william ross wrote: > I did have it set up that way at one point. it worked quite nicely as > long as I made the singleton in a subclass of the main Factory (which > might be shared by several applications with different configurations). > i gave up on it in the end because it seemed a bit overheated, but if > you approve, i shall reconsider. I'm not quite following you. Overheated? > so, rehearsing: all it should take is a Factory::Subclass->new(config > blah) in the startup script and a Factory::Subclass->instance() in the > handler? it does sound good if you put it like that. > > incidentally I made the singleton like this (yes, more poop): > > use base qw (Class::DBI::Factory Class::Singleton); > ... > sub _new_instance { shift->new(@_) } > > but it felt rather naughty to subclass the private _new_instance. if > anyone knows a better way, I'd be very glad to hear it. Check out Class::Singleton. -dave /*================== www.urth.org we await the New Sun ==================*/