Re: Singleton Persistence

2014-02-27 Thread Rolf Schaufelberger
Hi, we are using Class:Singleton , yet we manually destroy the singleton at the beginning of each request before we create a new one. So I have a class PW::Application which isa Class::Singleton and then { no strict 'refs'; ${PW::Application\::_instance}= undef; }

Re: Singleton Persistence

2014-02-27 Thread John Dunlap
In the solution that I ended up using, the singleton in question contains the reference to IOC::Container, which contains service literals for each of the constants which are available in $apache-dir_config. As a performance enhancement, when I attempt to retrieve an object from the container, I

Re: Singleton Persistence

2014-02-04 Thread Vincent Veyron
Le lundi 03 février 2014 à 19:13 -0500, Perrin Harkins a écrit : On Mon, Feb 3, 2014 at 5:33 PM, Chris Bennett ch...@bennettconstruction.us wrote: Right now I am using pg_1_.pl and pg_2.pl on the different hosts, but the code is identical, except that some data is pulled in from a config

Re: Singleton Persistence

2014-02-04 Thread Chris Bennett
On Tue, Feb 04, 2014 at 11:42:43AM +0100, Vincent Veyron wrote: Le lundi 03 février 2014 à 19:13 -0500, Perrin Harkins a écrit : On Mon, Feb 3, 2014 at 5:33 PM, Chris Bennett ch...@bennettconstruction.us wrote: Right now I am using pg_1_.pl and pg_2.pl on the different hosts, but the

Re: Singleton Persistence

2014-02-03 Thread Vincent Veyron
Le samedi 01 février 2014 à 20:14 -0500, John Dunlap a écrit : In mod_perl, can instantiated singletons survive requests? I'm asking because I appear to have one which *appears* to be bouncing back and forth between virtual hosts as perl interpreters are recycled. Is this possible and, if yes,

Re: Singleton Persistence

2014-02-03 Thread John Dunlap
My current workaround is using this option in my apache configuration, PerlOptions +Parent to make sure that interpreters aren't shared between virtualhosts. However, this isn't good from a resource sharing perspective so it sounds like I may need to re-architect some of my code. On Mon, Feb 3,

Re: Singleton Persistence

2014-02-03 Thread John ORourke
I do it by treating the request as something transient - in other words assuming that interpreter state is maintained between requests, and resetting or recreating all the objects I use to process the request in my fixup handler. I make use of the persistence by having a singleton that maintains

Re: Singleton Persistence

2014-02-03 Thread Chris Bennett
On Mon, Feb 03, 2014 at 04:44:01PM -0500, John Dunlap wrote: My current workaround is using this option in my apache configuration, PerlOptions +Parent to make sure that interpreters aren't shared between virtualhosts. However, this isn't good from a resource sharing perspective so it sounds

Re: Singleton Persistence

2014-02-03 Thread Vincent Veyron
Le lundi 03 février 2014 à 21:49 +, John ORourke a écrit : I do it by treating the request as something transient - in other words assuming that interpreter state is maintained between requests, and resetting or recreating all the objects I use to process the request in my fixup handler.

Re: Singleton Persistence

2014-02-03 Thread Perrin Harkins
On Sat, Feb 1, 2014 at 8:14 PM, John Dunlap j...@lariat.co wrote: In mod_perl, can instantiated singletons survive requests? Sure, anything you put in a global will survive until the httpd child process is shut down. How many requests each child serves depends on your configuration. When a new

Re: Singleton Persistence

2014-02-03 Thread Perrin Harkins
On Mon, Feb 3, 2014 at 5:33 PM, Chris Bennett ch...@bennettconstruction.us wrote: Right now I am using pg_1_.pl and pg_2.pl on the different hosts, but the code is identical, except that some data is pulled in from a config file for the different databases, etc used. Can I safely use pg.pl on

Singleton Persistence

2014-02-01 Thread John Dunlap
In mod_perl, can instantiated singletons survive requests? I'm asking because I appear to have one which *appears* to be bouncing back and forth between virtual hosts as perl interpreters are recycled. Is this possible and, if yes, how do I prevent it? Cheers! John