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

[email protected] Mon, 9 Jun 2008 13:48:57 -0700 (PDT)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Mon Jun  9 13:48:57 2008
New Revision: 347

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

Log:
generate proper per-file module names


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	Mon Jun  9 13:48:57 2008
@@ -23,18 +23,12 @@
 sub gen_module_name($path)
 {
     # until we have substitutions, use split/join to sanitize the path.
-    # for some reason, split isn't working inside of mod_parrot, so we'll
-    # just generate random module names until we fix the problem
+    my @pieces = split('/', $path);
+    my $name = join('_', @pieces);
+    @pieces = split('-', $name);
+    $name = join('_', @pieces);
 
-    #my $path = "$path";
-    #my @pieces = split('/', $path);
-    #@pieces.push(split('-', $path));
-    #my $mod = "ModPerl6::Registry::Script::" ~ join('_', @pieces);
-
-    my $mod;
-    repeat {
-        $mod = "ModPerl6::Registry::Script" ~ rand(1000000);
-    } while (%registry{$mod});
+    my $mod = "ModPerl6::Registry::Script::$name";
 
     $mod;
 }