[Catalyst] Passing REMOTE_USER to development server

Tomas Doran bobtfish at bobtfish.net
Fri Mar 2 19:57:48 GMT 2012

On 2 Mar 2012, at 09:08, Stephen Shorrock wrote:

> Dear list,
> I realise that this is a very basic question.
> Using an older version of Catalyst (5.80007) I used  to start the
> development server with:
> REMOTE_USER=userid myapp_server.pl
> and have available in the application userid via $ENV{REMOTE_USER}.
> Having upgraded to 5.90010 this no longer appears to work nor does
> attempting to access via $c->engine->env or $c->req->remote_user.
> How can I set the remote user on development user startup and then how
> should I access it in my controller?

It can be accesses in almost the same way:

$c->req->remote_user is preferred, but it's also available in $c->req->env (or $c->engine->env for back compat - but please don't use this in new code!)

And the answer is that PSGI doesn't just glob everything through %ENV any more - if you're using Catalyst::Test then passing remote user works as before, but for your own manual testing you'll want  to write a small PSGI file (or use placket to start your app) to inject it into the environment.

See Plack::Middleware::ForceEnv.

I'd love to see a doc patch from someone making this clear in Catalyst::PSGI and/or Catalyst::Upgrading?


More information about the Catalyst mailing list