| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Catalyst::Plugin::Environment; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 34951 | use namespace::autoclean; | 
|  | 1 |  |  |  |  | 27296 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 4 | 1 |  |  | 1 |  | 550 | use Moose::Role; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = '0.02'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | after setup_finalize => sub { | 
| 10 |  |  |  |  |  |  | my $class = shift; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | my $config = $class->config->{'Plugin::Environment'} || { }; | 
| 13 |  |  |  |  |  |  | $ENV{$_} = $config->{$_} | 
| 14 |  |  |  |  |  |  | for keys %$config; | 
| 15 |  |  |  |  |  |  | }; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | 1 | 
| 19 |  |  |  |  |  |  | __END__ | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =pod | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =head1 NAME | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | Catalyst::Plugin::Environment - Catalyst plugin to modify C<%ENV> via your application configuration | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | # in MyApp.pm | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | use Catalyst qw( ... Environment ... ); | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | __PACKAGE__->config->{'Plugin::Environment'} = { | 
| 34 |  |  |  |  |  |  | Foo => 'Bar', | 
| 35 |  |  |  |  |  |  | Baz => 'Qux', | 
| 36 |  |  |  |  |  |  | }; | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | Catalyst::Plugin::Environment allows you to specify environment variable | 
| 41 |  |  |  |  |  |  | values that should be set during application startup.  This is useful if | 
| 42 |  |  |  |  |  |  | you rely on modules that use environment variables but don't want these | 
| 43 |  |  |  |  |  |  | to be managed outside of your application. | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =head1 AUTHOR | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | jason hord E<lt>pravus@cpan.orgE<gt> | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | Copyright (c) 2012-2014, jason hord | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | Permission is hereby granted, free of charge, to any person obtaining a copy | 
| 54 |  |  |  |  |  |  | of this software and associated documentation files (the "Software"), to deal | 
| 55 |  |  |  |  |  |  | in the Software without restriction, including without limitation the rights | 
| 56 |  |  |  |  |  |  | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
| 57 |  |  |  |  |  |  | copies of the Software, and to permit persons to whom the Software is | 
| 58 |  |  |  |  |  |  | furnished to do so, subject to the following conditions: | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | The above copyright notice and this permission notice shall be included in | 
| 61 |  |  |  |  |  |  | all copies or substantial portions of the Software. | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
| 64 |  |  |  |  |  |  | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
| 65 |  |  |  |  |  |  | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
| 66 |  |  |  |  |  |  | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
| 67 |  |  |  |  |  |  | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
| 68 |  |  |  |  |  |  | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
| 69 |  |  |  |  |  |  | THE SOFTWARE. | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =cut |