[svn:mod_parrot] r484 - mod_parrot/trunk/languages/perl6/lib/ModPerl6

[email protected] Sun, 9 Nov 2008 15:03:00 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Sun Nov  9 15:02:58 2008
New Revision: 484

Modified:
   mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm

Log:
set some more CGI environment variables:
* HTTP_COOKIE
* CONTENT_LENGTH
* MODPERL6



Modified: mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm
==============================================================================
--- mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm	(original)
+++ mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm	Sun Nov  9 15:02:58 2008
@@ -26,10 +26,18 @@
         %registry{$mod} = $script;
     }
 
+    # grab interesting stuff from headers
+    my $headers_in = $r.headers_in();
+    my $content_length = $headers_in.get('Content-Length');
+    my $cookies = $headers_in.get('Cookie');
+
     # set environment variables expected by CGI scripts
     # XXX binding (:=) works, but assigning (=) doesn't
+    %*ENV<MODPERL6> := 1;
     %*ENV<QUERY_STRING> := $r.args();
     %*ENV<REQUEST_METHOD> := $r.method();
+    %*ENV<CONTENT_LENGTH> := $content_length;
+    %*ENV<HTTP_COOKIE> := $cookies;
 
     my $interp = ModParrot::Interpreter.new();
     $interp.capture_stdout(1);