On Wednesday, October 2, 2002, at 09:48 PM, Dave Rolsky wrote:
> 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? sorry. i just meant that it seemed like a lot of engineering - much of which was a little beyond me, though I've caught up a bit since - for what seemed like such a simple requirement. but i've just been doing as you suggested, and it does work rather nicely. thanks. >> 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. (dimwit: both calls should be to instance(). oops) >> 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. er, that's what I said. guess it must be ok :) will