[Bps-public-commit] r10143 - in Test-Dependencies/trunk: lib/Test

zev at bestpractical.com zev at bestpractical.com
Thu Dec 27 03:33:04 EST 2007


Author: zev
Date: Thu Dec 27 03:33:04 2007
New Revision: 10143

Modified:
   Test-Dependencies/trunk/   (props changed)
   Test-Dependencies/trunk/lib/Test/Dependencies.pm

Log:
 r10361 at cliffjumper:  zev | 2007-12-27 02:00:15 -0500
 * clean up code for passing arguments to module


Modified: Test-Dependencies/trunk/lib/Test/Dependencies.pm
==============================================================================
--- Test-Dependencies/trunk/lib/Test/Dependencies.pm	(original)
+++ Test-Dependencies/trunk/lib/Test/Dependencies.pm	Thu Dec 27 03:33:04 2007
@@ -46,22 +46,19 @@
 our $exclude_re;
 
 sub import {
-  my $package = $_[0];
+  my $package = shift;
+  my %args = @_;
   my $callerpack = caller;
   my $tb = __PACKAGE__->builder;
   $tb->exported_to($callerpack);
   $tb->no_plan;
 
-  if (scalar @_ == 3) {
-    # package name, literal exclude, excluded namespaces
-    my $exclude = $_[2];
-    foreach my $namespace (@$exclude) {
+  if (defined $args{exclude}) {
+    foreach my $namespace (@{$args{exclude}}) {
       croak "$namespace is not a valid namespace"
         unless $namespace =~ m/^(?:(?:\w+::)|)+\w+$/;
     }
-    $exclude_re = join '|', @$exclude;
-  } elsif (scalar @_ != 1) {
-    croak "wrong number of arguments while using Test::Dependencies: " . join ' ', @_;
+    $exclude_re = join '|', @{$args{exclude}};
   }
   $package->export_to_level(1, '', qw/ok_dependencies/);
 }



More information about the Bps-public-commit mailing list