Skip to content

campus-explorer/catalyst-traitfor-context-psgi-findenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Catalyst::TraitFor::Context::PSGI::FindEnv - Hunt down our PSGI environment, even in 5.8x

VERSION

This document describes version 0.001 of Catalyst::TraitFor::Context::PSGI::FindEnv - released October 31, 2012 as part of Catalyst-TraitFor-Context-PSGI-FindEnv.

DESCRIPTION

This is a Catalyst context trait that aids in finding a PSGI environment, if one is available, even in a 5.8x environment.

Note the key part about "if one is available" :) This is not always the case under 5.8x.

METHODS

psgi_env

This method will attempt to locate and return the PSGI environment hashref. If one is not found, nothing will be returned.

TRAIT APPLICATION

Neither CatalystX::Component::Traits nor CatalystX::RoleApplicator handle applying context class traits at the moment.

Directly in your application class

with 'Catalyst::TraitFor::Context::PSGI::FindEnv';

In your PSGI file

If you're only enabling this for debug purposes, it might be better to conditionalize this in your app.psgi, with something like:

Catalyst::TraitFor::Context::PSGI::FindEnv
    ->meta
    ->apply(Class::MOP::class_of('MyApp'))
    ;

...or, as that's a bit of a mouthful:

use Moose::Util 'ensure_all_roles';
ensure_all_roles MyApp => 'Catalyst::TraitFor::Context::PSGI::FindEnv';

Both do the same thing (for generally indistinguishable values of "same thing").

Note that your application class will need to be mutable (that is, not immutable) for these approaches to work.

SOURCE

The development version is on github at http://github.com/RsrchBoy/Catalyst-TraitFor-Context-PSGI-FindEnv and may be cloned from git://github.com/RsrchBoy/Catalyst-TraitFor-Context-PSGI-FindEnv.git

AUTHOR

Chris Weyl <[email protected]>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2012 by Chris Weyl.

This is free software, licensed under:

The GNU Lesser General Public License, Version 2.1, February 1999

About

Catalyst::TraitFor::Context::PSGI::FindEnv

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages