fix POD
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine.pm
index 45b1c7b..2ca6a39 100644 (file)
@@ -10,10 +10,11 @@ use HTML::Entities;
 use HTTP::Body;
 use HTTP::Headers;
 use URI::QueryParam;
-use Scalar::Util ();
 
 use namespace::clean -except => 'meta';
 
+has env => (is => 'rw');
+
 # input position and length
 has read_length => (is => 'rw');
 has read_position => (is => 'rw');
@@ -46,7 +47,7 @@ sub finalize_body {
     my ( $self, $c ) = @_;
     my $body = $c->response->body;
     no warnings 'uninitialized';
-    if ( Scalar::Util::blessed($body) && $body->can('read') or ref($body) eq 'GLOB' ) {
+    if ( blessed($body) && $body->can('read') or ref($body) eq 'GLOB' ) {
         while ( !eof $body ) {
             read $body, my ($buffer), $CHUNKSIZE;
             last unless $self->write( $c, $buffer );
@@ -76,7 +77,7 @@ sub finalize_cookies {
         my $val = $response->cookies->{$name};
 
         my $cookie = (
-            Scalar::Util::blessed($val)
+            blessed($val)
             ? $val
             : CGI::Simple::Cookie->new(
                 -name    => $name,
@@ -675,6 +676,18 @@ sub unescape_uri {
 
 <obsolete>, see finalize_body
 
+=head2 $self->env
+
+Hash containing enviroment variables including many special variables inserted
+by WWW server - like SERVER_*, REMOTE_*, HTTP_* ...
+
+Before accesing enviroment variables consider whether the same information is
+not directly available via Catalyst objects $c->request, $c->engine ...
+
+BEWARE: If you really need to access some enviroment variable from your Catalyst
+application you should use $c->engine->env->{VARNAME} instead of $ENV{VARNAME},
+as in some enviroments the %ENV hash does not contain what you would expect.
+
 =head1 AUTHORS
 
 Catalyst Contributors, see Catalyst.pm