> > I was trying to use $ENV{'HTTP_REFERER'} in a certain script, and as I
> > reloaded the script over and over I noticed that it would constantly
> > be changing when the page was loaded directly (and therefore there
> > should not have been any HTTP_REFERER at all).

>
> In my setup at least, HTTP_REFERER is reset between requests. I
> believe non-CGI environment variables will be passed through from the
> parent process, and all CGI variables and anything else set by Apache
> (i.e. starting with HTTP_) will be reset for each request.


I'm wondering if this is because I am using a custom handler, and not
the default Apache::Registry handler. Maybe Apache::Registry resets
%ENV?

When you write a handler, are you supposed to clear %ENV at the end of
each request? I noticed that if I put "undef %ENV" at the very end of
my handler, then things would behave as normal and I'd get a clean
environment on each request. The trouble is, I don't know if this has
any unintended side effects, so I took it out.

For now, I just changed the requests for $ENV{'VAR'} to instead call
subprocess_env('VAR'). Unfortunately, I don't know if this correct
either.