Setting REMOTE_USER Apache variable in scripts
REMOTE_USER is an Apache server variable that is sometimes set on web pages. It is useful for identifying users who log in, since it can be stored in the Apache logs. It’s similar to session variables, but it’s not as easy to change.
In modperl, the simplest way to set REMOTE_USER is:$r->user("Joe Shmoe");
where $r is a RequestRec object, and “Joe Shmoe” is what we are setting REMOTE_USER to.
Note that this is the “new” way to change the user name. The “old” way looks like:$r->connection->user("Joe Shmoe");
Modperl 2.0 recommends using the first method over the latter, which is now deprecated. You may however see old code using the second method, so it is useful to be aware of it.
See the explanation of the deprecation_.