How can I start a mod_perl handler (called MyCacheHandler.pm) directly from another perl module (called MyModule.pm). Because currently I'm starting the handler via a web browser, but it would be a little bit easier to call it with MyModule.
Start mod_perl handler from another perl module
105 Views Asked by atticus3000 At
2
There are 2 best solutions below
1
On
Do some refactoring. Split MyCacheHandler.pm into two modules: one which is doing the hard work and does not depend on mod_perl anymore (that is, no more handling with $r), so it's callable from other modules. The other would be a now thin mod_perl handler calling the first module.
Or leave it as is, and just use LWP::UserAgent to access MyCacheHandler from MyModule.
As I understand it, you want to have it (
MyCacheHandler) running in the background, and it won't produce any visible (to a browser) output? (Just side effects).If that's correct, why is it even implemented as a
mod_perlhandler. Just implement it as a script and run it fromcron, or as adaemonof some kind.You could still control
MyCacheHandlerfromMyModule(say via IPC).