You might be able to do what you want without forking, and without tying up your
apache process while the database sync takes place.

Just write a server process using something like IO::Socket or POE (see
http://poe.perl.org).  Have the mod_perl handler send a message to the separate
server process to start the long-running job.  You might even be able to query
the server process from mod_perl to check on the status of said job, to report
the status to the web browser.    I started work on this sort of solution last
spring, and it looked feasible, but I got pulled to a different project before I
could fully implement it.  I'm curious to see what others think of this
approach.

HTH,

Wes Sheldahl




"Mike P. Mikhailov" <[EMAIL PROTECTED]> on 10/08/2001
10:46:41 AM

Please respond to "Mike P. Mikhailov" <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Wesley Sheldahl/Lex/Lexmark)
Subject:  Can't locate object method "cleanup_for_exec" via package "Apache"


Hi list,

   I'm understood that fork'ing from mod_perl is not very good idea,
   but we have no choice. Because it is up to user to decide to launch
   job which syncronize data in the two database sources. And this job
   may take a long time.

   I'm has no expirience before in using fork call, so I'm reading
   chapter '10.4.3 Forking and Executing Subprocesses from mod_perl'
   of mod_perl Guide careful.

   I'm understood that I must cleanup soket in child process.
   In '10.4.3.2 Freeing the Parent Process' written [c&p]: 'Apache::SubProcess
   comes to help and provides a method cleanup_for_exec() which takes
   care of closing this file descriptor.' p 365. But I'm does not see
   such sub in the Apache::Subprocess. And my code generates run time error

        Can't locate object method "cleanup_for_exec" via package "Apache"

   My RH linux with kernel 2.2.14-5.0, Apache/1.3.12 (Unix) mod_perl/1.25
   mod_perl Guide: Version 1.30 Sep, 2 2001. Apache::SubProcess v0.02.

   Am I miss something ?

--
Best regards,
 Mike                          mailto:[EMAIL PROTECTED]








Reply via email to