[Catalyst] Application Testing, Mocking Apache Headers/Environment

Tomas Doran bobtfish at bobtfish.net
Mon Apr 16 07:58:27 GMT 2012

On 16 Apr 2012, at 07:11, brainbuz wrote:

> In my auto action I have something like:
> $c->{ USERNAME } = $c->engine->env->{ HTTP_COOKIE  } ;#Authenticated via apache 2.4 mod_auth_form
> $c->{ USERRIGHTS } = $c->model( ‘method returning a ref to a list of the rights for $c->{ USERNAME }’);

Writing into the context object like this is fairly disrecommended - using the stash (or adding accessors on your context) is probably nicer..

Also, the authentication framework can probably do most of the heavy lifting for you instead of doing this manually…

Anyway, no matter - the answer you're probably looking for is to use Plack::Middleware::ForceEnv


More information about the Catalyst mailing list