Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

is there a way to (temporarily) switch off mod_perl caching/variable storing?

by tomgracey (Beadle)
on Jul 10, 2013 at 18:36 UTC ( #1043529=perlquestion: print w/ replies, xml ) Need Help??
tomgracey has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I have been trying to run git through apache (ie web based version control) but git is really living up to its name and refusing to cooperate. (Just finished 2 more days of tearing hair out). Now I'm wondering if there isn't some mod_perl weirdness going on.

I have found, after (very) lengthy experimentation the simplest way I can get my error is as follows:
#!/usr/bin/perl use strict; my @out = `cd /test/repo; git commit -m 'msg' 2>&1`; print "Content-type: text/plain\n\n"; print "@out\n";

What I do is I set up /test/repo so it has files waiting to commit, make sure everything belongs to apache and then fire the script off in the browser.

What I am finding now is that if I run it immediately after restarting apache it works:

[master (root-commit) 4324b48] msg Committer: Apache <apache> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 31 insertions(+) create mode 100644 file.txt

... but next time I try it (after deleting the .git folder etc and resetting - but not restarting apache) I get

error: unable to create temporary file: No such file or directory fatal: failed to write commit object

and it doesn't work from then on. I am wondering if mod_perl isnt responsible for this odd behaviour, ie trying to use a cached value somewhere the second time around. Does anyone know a way I can test this?

Otherwise, any general thoughts on what might be going on?

Comment on is there a way to (temporarily) switch off mod_perl caching/variable storing?
Select or Download Code
Re: is there a way to (temporarily) switch off mod_perl caching/variable storing?
by moritz (Cardinal) on Jul 10, 2013 at 18:39 UTC
    I am wondering if mod_perl isnt responsible for this odd behaviour, ie trying to use a cached value somewhere the second time around. Does anyone know a way I can test this?

    Run it without mod_perl in plain CGI. Then you know if mod_perl matters at all for your issue.

      Glad they say 'the only stupid question is the one not asked' because otherwise my questions would always win the prize

      Of course. Just dont use mod_perl at all

      So I set up a script dir via introducing a ScriptAlias... line in my httpd.conf and ran the test scripts there. It looks like my suspicions are correct - it runs every time without complaint under CGI.

      So the next question is, what can I do now? Of course I don't want to have to work under CGI. Is there a way I can get mod_perl to flush its buffers? Or some way to get better visibility of what it is actually doing that is causing the problem?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1043529]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-04-18 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (462 votes), past polls