[svn:parrot] r46447 - trunk/lib/Parrot

petdance at svn.parrot.org petdance at svn.parrot.org
Sun May 9 21:50:20 UTC 2010


Author: petdance
Date: Sun May  9 21:50:20 2010
New Revision: 46447
URL: https://trac.parrot.org/parrot/changeset/46447

Log:
hiding the namespace mucking in a function

Modified:
   trunk/lib/Parrot/Test.pm

Modified: trunk/lib/Parrot/Test.pm
==============================================================================
--- trunk/lib/Parrot/Test.pm	Sun May  9 21:38:57 2010	(r46446)
+++ trunk/lib/Parrot/Test.pm	Sun May  9 21:50:20 2010	(r46447)
@@ -443,7 +443,7 @@
             # set a todo-item for Test::Builder to find
             my $call_pkg = $self->{builder}->exported_to() || '';
 
-            no strict 'refs';
+            no strict 'refs';  ## no critic Variables::ProhibitConditionalDeclarations
 
             local *{ $call_pkg . '::TODO' } = ## no critic Variables::ProhibitConditionalDeclarations
                 \$options{todo}
@@ -500,12 +500,22 @@
 
         my ($package) = caller();
 
-        no strict 'refs';
-
-        *{ $package . '::' . $func } = $test_sub;
+        create_sub($package, $func, $test_sub);
     }
 }
 
+sub create_sub {
+    my $package = shift;
+    my $func    = shift;
+    my $sub     = shift;
+
+    no strict 'refs';
+
+    *{ $package . '::' . $func } = $sub;
+
+    return;
+}
+
 =over
 
 =item "pbc_postprocess_output_like"
@@ -766,9 +776,7 @@
             return $pass;
         };
 
-        no strict 'refs';
-
-        *{ $package . '::' . $func } = $test_sub;
+        create_sub($package, $func, $test_sub);
     }
 
     ##### 2: PIR-to-PASM test map #####
@@ -860,9 +868,7 @@
             return $pass;
         };
 
-        no strict 'refs';
-
-        *{ $package . '::' . $func } = $test_sub;
+        create_sub($package, $func, $test_sub);
     }
 
     ##### 3: Language test map #####
@@ -926,9 +932,7 @@
             }
         };
 
-        no strict 'refs';
-
-        *{ $package . '::' . $func } = $test_sub;
+        create_sub($package, $func, $test_sub);
     }
 
     ##### 4:  Example test map #####
@@ -973,9 +977,7 @@
             }
         };
 
-        no strict 'refs';
-
-        *{ $package . '::' . $func } = $test_sub;
+        create_sub($package, $func, $test_sub);
     }
 
     ##### 5: C test map #####
@@ -1100,9 +1102,7 @@
             return $pass;
         };
 
-        no strict 'refs';
-
-        *{ $package . '::' . $func } = $test_sub;
+        create_sub($package, $func, $test_sub);
     }
 
     return;


More information about the parrot-commits mailing list