Author: jhorwitz
Date: Fri Apr 24 12:27:23 2009
New Revision: 629
Modified:
mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm
Log:
fix I/O binding
change wrapper sub-name to avoid bug w/ leading underscore
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 Fri Apr 24 12:27:23 2009
@@ -64,7 +64,7 @@
unless (%registry{$script}) {
my $data = slurp $script;
my $mod = gen_module_name($script);
- my $code = "module $mod; sub _handler \{ $data \}";
+ my $code = "module $mod; sub reg__handler \{ $data \}";
eval $code;
%registry{$script} = $mod;
%registry{$mod} = $script;
@@ -95,17 +95,21 @@
my $mod = %registry{$script};
# tie I/O to $r, saving the old filehandles
- my $mpi = ModParrot::Interpreter.new();
+ my $mpi = ::ModParrot::Interpreter.new();
my $stdin = $mpi.stdin($r);
my $stdout = $mpi.stdout($r);
+ $*IN := $mpi.stdin;
+ $*OUT := $mpi.stdout;
# run our code
#::($mod)::_handler();
- my $res = ModPerl6::Fudge::call_sub_with_namespace($mod, '_handler');
+ my $res = ModPerl6::Fudge::call_sub_with_namespace($mod, 'reg__handler');
# restore I/O filehandles
$mpi.stdin($stdin);
$mpi.stdout($stdout);
+ $*IN := $stdin;
+ $*OUT := $stdout;
return $Apache::Const::OK;
}