Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: mod_perl odd behaviour with system() or exec() call or backticks

by perlfan (Vicar)
on Jul 10, 2014 at 11:22 UTC ( [id://1093030]=note: print w/replies, xml ) Need Help??


in reply to mod_perl odd behaviour with system() or exec() call or backticks

mod_perl is "persistent" meaning processes hang around for a while, and unless properly managed variables are not going to be reassigned like you think they are; it's not unlike a "stale cache" problem.

I believe that what you are seeing is due to this persistence, so you need a handler that will recompile the script each time a requests is handled by Apache. This PerlResponseHandler is ModPerl::PerlRun.

See Re: mod-perl configuration under Apache2.

Last note, mod_perl is really nice once you understand that it a way to hook deeply into Apache's requesting life cycle to facilitate an application, but it'd be easier for you to port it to a pure CGI environment that doesn't try to be smart with persistence. CGI is much more akin to running it at the command line - just be careful of %ENV not being what you expect it to be.

Replies are listed 'Best First'.
Re^2: mod_perl odd behaviour with system() or exec() call or backticks
by pucek (Initiate) on Jul 11, 2014 at 09:12 UTC
    Thank you for your feedback. Unfortunately my virtual host was already using ModPerl::PerlRun as PerlResponseHandler.
      Is traditional CGI an option? It's been mentioned that in this situation it is your best bet since you're literally running the script once per request. The only difference is going to be that you will have to ensure that your shebang and environmentals are as expected, namely @INC and %ENV.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1093030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found