French, Shawn wrote:
> Hey everyone,
> 
> It's me again... the persistent telnet mod_perl newbie!
> (http://msgs.securepoint.com/cgi-bin/get/apache0205/204.html)
> 
> I have implemented my project using persistent telnet connections (one for
> each user session accessible throught the session to perform various
> functions through telnet) on win2000:
> Apache/1.3.26 (Win32) mod_perl/1.27_01-dev
> 
> Now for my next trick! 
> When I started I didn't realize that mod_perl on win32 could only handle one
> request at a time!!! This is obviously not acceptable for deployment.
> 
> So, I would like to upgrade to Apache2/mod_perl2 to take advantage of the
> multi-process mod_perl model that the _very_ kind Randy Kobes told me about
> (http://groups.google.ca/groups?dq=&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=afv3gu%
> 24qt2%242%40canopus.cc.umanitoba.ca). However, with a multi-process model,
> I'm not sure how I will be able to keep a user's telnet-session-object
> accessible throughout multiple requests. Currently it's not a problem since
> there's only one process for ALL mod_perl requests. In Apache2/mod_perl2
> there will be more than one process so I need some sort of mapping to make
> sure my clients are aways served by the same process. Is this possible? Am I
> in way over my head (again!!) ?

It seems that you are after the same functionality as Apache::DBI, you 
want a pool of items that you want to be able to choose from. Look for 
threads::shared (perl 5.8.0), just create a shared hash with keys that 
you use for the map and the values for the actual connection objects.

If you can have the client persist the connection, you can implement a 
real protocol module. e.g., see:
http://perl.apache.org/docs/2.0/user/handlers/handlers.html#PerlProcessConnectionHandler

> Another problem is that I have also been informed that my _MUCH_ used
> apache_notes function in php will not be available to me in Apache2
> (http://bugs.php.net/bug.php?id=17557). I realize this is an Apache2 thing,
> but I was wondering if anyone here knows of a workaround that will allow my
> php scripts to communicate with mod_perl (and vice-versa) until (hopefully)
> the function is ported to Apache2.

 From what I understood mod_php in 2.0 is going to be implemented as a 
filter. Is that right? Is that the reason why notes won't work anymore? 
I don't think so. Practically there should be a problem to implement 
this feature, because you have a connection object which persists for 
the whole connection, so you should be able to register some data in 
this object and then retrieve it later in some other phase/filter.

in mod_perl handler you simply get the connectin object and stick 
something into the notes, e.g. inside request handlers:

my $r = shift;
my $c = $r->connection;
$c->notes->set(mod_perl => 'rules');

and then later for example in a mod_perl filter handler you do:

my $f = shift;
my $c = $f->connection;
my $is = $c->notes->get("mod_perl");
$f->print("mod_perl $is");

you should ask php folks why cannot they get c->notes working, the C 
datastructure is all there waiting to be used.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to