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

[email protected] Thu, 1 Jan 2009 16:34:53 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Thu Jan  1 16:34:52 2009
New Revision: 570

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

Log:
also tie stdin to a ModParrotHandle


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	Thu Jan  1 16:34:52 2009
@@ -94,21 +94,17 @@
 
     my $mod = %registry{$script};
 
-    # XXX rip this out when we have a pure-perl6 Apache::RequestRec
-    my $rr = q:PIR<
-        $P0 = find_lex "$r"
-        getattribute %r, $P0, 'r'
-    >;
-
-    # tie stdout to $r, saving the old stdout filehandle
+    # tie I/O to $r, saving the old filehandles
     my $mpi = ModParrot::Interpreter.new();
+    my $stdin = $mpi.stdin($r);
     my $stdout = $mpi.stdout($r);
 
     # run our code
     #::($mod)::_handler();
     my $res = ModPerl6::Fudge::call_sub_with_namespace($mod, '_handler');
 
-    # reset stdout
+    # restore I/O filehandles
+    $mpi.stdin($stdin);
     $mpi.stdout($stdout);
 
     return $Apache::Const::OK;