Re: Fwd: MPM-safe mp2 Singleton Pattern?
Am Freitag, 7. November 2008 19:22:56 schrieb Steven Siebert:[color=blue]
> Perfect! Great info from both...exactly what I needed. After
> Torsten's response, I theorized that I could abstract that
> functionality up and reveal a thin API for the creation/calling of
> singleton objects within a namespace in pnotes....but that seems to
> have already been done with Apache::Singleton::Request. I'm glad I
> decided to ask the experts before attempting a hack myself. Thanks
> On Fri, Nov 7, 2008 at 1:18 PM, bharanee rathna <email@example.com> wrote:[color=green][color=darkred]
> >> The simplest way is to put the object as a pnote:[/color]
> > What Torsten said, but have a look at
> > [url]http://search.cpan.org/~miyagawa/Apache-Singleton-0.07/lib/Apache/Singlet[/url]
> > Apache::Singleton::Request is probably what you want.[/color][/color]
I couldn't get Apache::Singleton working with mp2 (used it before with no
problems with mp1). so I switched back to Class::Singelton and, at the top of
my handler (MasonX::WebApp) destroy the old instance and create a new one. I
couldn' t find ouy why it failed with mp2 since I had not much time and my
app had to become ready. The failure showed in a "hanging" request.
The reason why I use Class::Singelton (and not $r->pool or $r->pnotes) is
just, that I can reuse my perl modules in all apps running as stand alone
scripts. So for instance , I put my DBIx;:Class schema object in there, the
logging handler etc.