perl.cvs.mod_parrot
[Top] [All Lists]

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

Subject: [svn:mod_parrot] r350 - mod_parrot/trunk/languages/perl6/lib/ModPerl6
From: jhorwitz@xxxxxxxxxxxx
Date: Fri, 13 Jun 2008 10:13:17 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Fri Jun 13 10:13:17 2008
New Revision: 350

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

Log:
escape braces to avoid code interpolation


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 Jun 13 
10:13:17 2008
@@ -4,22 +4,6 @@
 
 our %registry;
 
-sub load_script($path)
-{
-    my $fh = open($path, 'r');
-    if (defined($fh)) {
-        my $data = "";
-        while (my $line = $fh.readline()) {
-            $data ~= "$line\n";
-        }
-        $fh.close();
-        $data;
-    }
-    else {
-        undef;
-    }
-}
-
 sub gen_module_name($path)
 {
     # until we have substitutions, use split/join to sanitize the path.
@@ -30,16 +14,16 @@
 
     my $mod = "ModPerl6::Registry::Script::$name";
 
-    $mod;
+    return $mod;
 }
 
 sub handler($r)
 {
     my $script = $r.filename();
     unless (%registry{$script}) {
-        my $data = load_script($script);
+        my $data = slurp $script;
         my $mod = gen_module_name($script);
-        my $code = "module $mod; sub _handler { $data }";
+        my $code = "module $mod; sub _handler \{ $data \}";
         eval $code;
         %registry{$script} = $mod;
         %registry{$mod} = $script;
@@ -55,5 +39,5 @@
     # should probably be write()
     $r.puts($buf);
 
-    0;
+    return 0;
 }

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r350 - mod_parrot/trunk/languages/perl6/lib/ModPerl6, jhorwitz <=