[Catalyst] How to access $c->apache in 5.9?

Hailin Hu i at h2l.name
Mon Apr 23 04:20:06 GMT 2012


Finally I solved the problem like this

# somewhere in module like after_login() in Admin.pm
if ( $ENV{ MOD_PERL } ) {
  my $r = $c->req->env->{'psgi.input'};
  $r->user( $c->user->uid );
}

Since the stuff is engine relevant, maybe it is better to be
implemented in Plack::Handler::Apache2 :)

On Fri, Apr 20, 2012 at 11:40 PM, Hailin Hu <i at h2l.name> wrote:
> I didn't catch you guys. Let me make my problem clearer.
>
> My catalyst application handles the auth process and I want Apache writes
> username into its log files, just like using Apache's basic auth module.
>
> 2012/04/20 21:59 "Tomas Doran" <bobtfish at bobtfish.net>:
>
>>
>> On 20 Apr 2012, at 12:56, Eden Cardim wrote:
>>
>> >>>>>> "Hailin" == Hailin Hu <i at h2l.name> writes:
>> >    Hailin> Finally, something like below works for me.
>> >
>> >    Hailin> my $apache = $c->engine->env->{'psgi.input'}; #
>> >    Hailin> Apache2::RequestRec $apache->user( $username );
>> >
>> >    Hailin> I supposed that an accessor of apache should be a method
>> > instead
>> >    Hailin> of a key of hash.  Is this the right way to retrieve the
>> >    Hailin> apache/mod_perl object?
>> >
>> > No it's not, this ties your application to a specific backend server
>> > implementation (which is what caused your problem in the first
>> > place). Whenever you need to access $c->engine->env, you should be
>> > applying a
>> > Plack::Middleware to your .psgi instead.
>>
>> For this specific thing, there is already $c->req->remote_user, which
>> should get this - no?
>>
>> https://metacpan.org/module/Catalyst::Request#req-remote_user
>>
>> http://search.cpan.org/~bobtfish/Catalyst-Plugin-Authentication-0.10018/lib/Catalyst/Authentication/Credential/Remote.pm
>>
>> Cheers
>> t0m
>>
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list