Fixed FastCGI engine to not clobber the global %ENV on each request (Sam Vilain)
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / FastCGI.pm
index f17178f..4ff269e 100644 (file)
@@ -61,9 +61,11 @@ sub run {
     }
 
     $options ||= {};
+    
+    my %env;
 
     my $request =
-      FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, $sock,
+      FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%env, $sock,
         ( $options->{nointr} ? 0 : &FCGI::FAIL_ACCEPT_ON_INTR ),
       );
 
@@ -78,7 +80,7 @@ sub run {
 
     while ( $request->Accept >= 0 ) {
         $proc_manager && $proc_manager->pm_pre_dispatch();
-        $class->handle_request;
+        $class->handle_request( env => \%env );
         $proc_manager && $proc_manager->pm_pre_dispatch();
     }
 }
@@ -155,7 +157,17 @@ This configuration was tested with Lighttpd 1.4.7.
         )
     )
     
-Or use an external server:
+You can also run your application at any non-root location.
+
+    fastcgi.server = (
+        "/myapp" => (
+            "MyApp" => (
+                # same as above
+            )
+        )
+    )
+    
+You can also use an external server:
 
     # Start the external server (requires FCGI::ProcManager)
     $ script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5