Fix '-all' option for the default group
Arthur Axel 'fREW' Schmidt [Mon, 30 Jul 2012 00:58:27 +0000 (19:58 -0500)]
Changes
lib/Sub/Exporter/Progressive.pm
t/all.t [new file with mode: 0644]
t/lib/A/JunkAll.pm [new file with mode: 0644]

diff --git a/Changes b/Changes
index 4dab640..47b76e0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for {{$dist->name}}
 
 {{$NEXT}}
+  - Fix '-all' option for the default group
 
 0.001000  2012-07-29 16:44:01 America/Chicago
   - Initial Release
index 325d103..d945936 100644 (file)
@@ -76,12 +76,12 @@ sub sub_export_options {
                if first { $_ ne 'default' } keys %{$options{groups}};
 
             @defaults = @{$options{groups}{default} || [] };
-            @defaults = @exports if $defaults[0] eq '-all';
          } else {
             $TOO_COMPLICATED = 1;
             last OPTIONS
          }
       }
+      @defaults = @exports if $defaults[0] eq '-all';
    }
 
    return $TOO_COMPLICATED, {
diff --git a/t/all.t b/t/all.t
new file mode 100644 (file)
index 0000000..9751d0e
--- /dev/null
+++ b/t/all.t
@@ -0,0 +1,14 @@
+
+use strict;
+use warnings;
+
+use Test::More;
+use List::Util 'first';
+use lib 't/lib';
+use A::JunkAll;
+
+ok(main->can('junk1'), 'sub exported');
+ok(main->can('junk2'), 'sub exported');
+ok(! $INC{'Sub/Exporter.pm'}, 'Sub::Exporter not loaded');
+
+done_testing;
diff --git a/t/lib/A/JunkAll.pm b/t/lib/A/JunkAll.pm
new file mode 100644 (file)
index 0000000..d3e6123
--- /dev/null
@@ -0,0 +1,13 @@
+package A::JunkAll;
+
+use Sub::Exporter::Progressive -setup => {
+  exports => [qw(junk1 junk2)],
+  groups => {
+     default => [ -all ],
+  },
+};
+
+sub junk1 { 1 }
+sub junk2 { 1 }
+
+1;