I have never used mod_perl, but I think it can do what I want. I need a
CGI program that (1) always stays in memory and (2) can process several CGI
clients at the same time (3) can check the Apache server for new CGI
requests without blocking.
I read most of Stas Beckman's "mod_perl Guide" and I have Ford's "refcard"
but I can't see how to do it. Would someone please point me in the right
direction?
The design is...
Apache
|
V
perl program "PT"
|
V
Java program
The perl program, PT, and the Java program must be never exit. The PT
sends requests to Java and gets results from Java on a socket. The PT uses
an ID number to match each result to the corresponding request. The Java
program uses threads to handle many requests concurrently, but each request
might take several seconds.
Obviously, the PT program must *not* process only one request at a time. I
want PT to be able to have many "open" CGI requests which can be stored in
a perl array (or hash table). The PT main loop should poll the socket from
Java (for results) and poll the Apache (for new requests).
Does the
$r = Apache->request();
block until a request arrives? Is there any way to set a timeout so that
it will not block?
Can I call
$r1 = Apache->request();
$r2 = Apache->request();
$r3 = Apache->request();
and then handle them in parallel, e.g.
$r1->print "Hello world";
$r2->print "Hello how are you";
$r3->print "Hello this is a test";
Once again, thanks for the help. If this is covered in a document
someplace, just give me a pointer.
John Henckel henckel@iname.com
Zumbro Falls, Minnesota, USA (507) 753-2216
http://geocities.com/jdhenckel/
CGI program that (1) always stays in memory and (2) can process several CGI
clients at the same time (3) can check the Apache server for new CGI
requests without blocking.
I read most of Stas Beckman's "mod_perl Guide" and I have Ford's "refcard"
but I can't see how to do it. Would someone please point me in the right
direction?
The design is...
Apache
|
V
perl program "PT"
|
V
Java program
The perl program, PT, and the Java program must be never exit. The PT
sends requests to Java and gets results from Java on a socket. The PT uses
an ID number to match each result to the corresponding request. The Java
program uses threads to handle many requests concurrently, but each request
might take several seconds.
Obviously, the PT program must *not* process only one request at a time. I
want PT to be able to have many "open" CGI requests which can be stored in
a perl array (or hash table). The PT main loop should poll the socket from
Java (for results) and poll the Apache (for new requests).
Does the
$r = Apache->request();
block until a request arrives? Is there any way to set a timeout so that
it will not block?
Can I call
$r1 = Apache->request();
$r2 = Apache->request();
$r3 = Apache->request();
and then handle them in parallel, e.g.
$r1->print "Hello world";
$r2->print "Hello how are you";
$r3->print "Hello this is a test";
Once again, thanks for the help. If this is covered in a document
someplace, just give me a pointer.
John Henckel henckel@iname.com
Zumbro Falls, Minnesota, USA (507) 753-2216
http://geocities.com/jdhenckel/