You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Doug MacEachern <do...@covalent.net> on 2000/09/27 20:02:23 UTC

$r->user vs. $r->connection->user

i've added an $r->user method as an alias to $r->connection->user,
now that `user' hangs off of the request_rec rather than
request_rec->connection in Apache 2.0

so by the time mod_perl-2.0 is ready to use, auth modules can work with
both versions.  for backwards compat you can use something like:

use constant R_USER => $mod_perl::VERSION >= 1.24_01;

my $user = R_USER ? $r->user : $r->connection->user;

which of course is optimized by the Perl compiler down to:

my $user = $r->user;

or

my $user = $r->connection->user;

for older versions.

then again, by the time mod_perl-2.0 is ready you should be safe to say:

use mod_perl 1.25; #require version 1.25 or higher

my $user = $r->user;