[Catalyst-commits] r9874 - HTTP-Request-AsCGI/trunk/lib/HTTP/Request

hdp at dev.catalyst.perl.org hdp at dev.catalyst.perl.org
Mon Apr 27 03:01:35 GMT 2009


Author: hdp
Date: 2009-04-27 04:01:34 +0100 (Mon, 27 Apr 2009)
New Revision: 9874

Modified:
   HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
Log:
fix 'enviroment' typo

Modified: HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
===================================================================
--- HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm	2009-04-27 03:01:26 UTC (rev 9873)
+++ HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm	2009-04-27 03:01:34 UTC (rev 9874)
@@ -10,8 +10,19 @@
 use IO::Handle;
 use IO::File;
 
-__PACKAGE__->mk_accessors(qw[ enviroment request stdin stdout stderr ]);
+__PACKAGE__->mk_accessors(qw[ environment request stdin stdout stderr ]);
 
+# old typo
+=begin Pod::Coverage
+
+  enviroment
+
+=end Pod::Coverage
+
+=cut
+
+*enviroment = \&environment;
+
 sub new {
     my $class   = shift;
     my $request = shift;
@@ -34,7 +45,7 @@
 
     $uri = $uri->canonical;
 
-    my $enviroment = {
+    my $environment = {
         GATEWAY_INTERFACE => 'CGI/1.1',
         HTTP_HOST         => $uri->host_port,
         HTTPS             => ( $uri->scheme eq 'https' ) ? 'ON' : 'OFF',  # not in RFC 3875
@@ -59,17 +70,17 @@
         $key =~ tr/-/_/;
         $key =~ s/^HTTP_// if $field =~ /^Content-(Length|Type)$/;
 
-        unless ( exists $enviroment->{$key} ) {
-            $enviroment->{$key} = $request->headers->header($field);
+        unless ( exists $environment->{$key} ) {
+            $environment->{$key} = $request->headers->header($field);
         }
     }
 
-    unless ( $enviroment->{SCRIPT_NAME} eq '/' && $enviroment->{PATH_INFO} ) {
-        $enviroment->{PATH_INFO} =~ s/^\Q$enviroment->{SCRIPT_NAME}\E/\//;
-        $enviroment->{PATH_INFO} =~ s/^\/+/\//;
+    unless ( $environment->{SCRIPT_NAME} eq '/' && $environment->{PATH_INFO} ) {
+        $environment->{PATH_INFO} =~ s/^\Q$environment->{SCRIPT_NAME}\E/\//;
+        $environment->{PATH_INFO} =~ s/^\/+/\//;
     }
 
-    $self->enviroment($enviroment);
+    $self->environment($environment);
 
     return $self;
 }
@@ -77,7 +88,7 @@
 sub setup {
     my $self = shift;
 
-    $self->{restore}->{enviroment} = {%ENV};
+    $self->{restore}->{environment} = {%ENV};
 
     binmode( $self->stdin );
 
@@ -127,7 +138,7 @@
 
     {
         no warnings 'uninitialized';
-        %ENV = %{ $self->enviroment };
+        %ENV = %{ $self->environment };
     }
 
     if ( $INC{'CGI.pm'} ) {
@@ -225,7 +236,7 @@
 
     {
         no warnings 'uninitialized';
-        %ENV = %{ $self->{restore}->{enviroment} };
+        %ENV = %{ $self->{restore}->{environment} };
     }
 
     open( STDIN, '<&'. fileno($self->{restore}->{stdin}) )
@@ -292,7 +303,7 @@
         
         $stdout = $c->stdout;
         
-        # enviroment and descriptors will automatically be restored 
+        # environment and descriptors will automatically be restored
         # when $c is destructed.
     }
     
@@ -302,7 +313,7 @@
     
 =head1 DESCRIPTION
 
-Provides a convinient way of setting up an CGI enviroment from a HTTP::Request.
+Provides a convinient way of setting up an CGI environment from a HTTP::Request.
 
 =head1 METHODS
 
@@ -313,7 +324,7 @@
 Constructor, first argument must be a instance of HTTP::Request
 followed by optional pairs of environment key and value.
 
-=item enviroment
+=item environment
 
 Returns a hashref containing the environment that will be used in setup. 
 Changing the hashref after setup has been called will have no effect.
@@ -324,7 +335,7 @@
 
 =item restore
 
-Restores the enviroment and descriptors. Can only be called after setup.
+Restores the environment and descriptors. Can only be called after setup.
 
 =item request
 




More information about the Catalyst-commits mailing list