feature.pl: Make 5.even bundle imply 5.odd
authorFather Chrysostomos <sprout@cpan.org>
Mon, 21 May 2012 06:01:58 +0000 (23:01 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 21 May 2012 23:51:46 +0000 (16:51 -0700)
Since the 5.18 feature bundle should be added long before 5.18, to
avoid last-minute blunders, and since it’s easy to forget to do it in
advance, have feature.pl do it automatically.

lib/feature.pm
regen/feature.pl

index bcbfb7a..37e571f 100644 (file)
@@ -32,6 +32,7 @@ $feature_bundle{"5.13"} = $feature_bundle{"5.11"};
 $feature_bundle{"5.14"} = $feature_bundle{"5.11"};
 $feature_bundle{"5.16"} = $feature_bundle{"5.15"};
 $feature_bundle{"5.17"} = $feature_bundle{"5.15"};
+$feature_bundle{"5.18"} = $feature_bundle{"5.15"};
 $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
 
 our $hint_shift   = 26;
@@ -247,6 +248,9 @@ The following feature bundles are available:
   :5.16     say state switch unicode_strings
             unicode_eval evalbytes current_sub fc
 
+  :5.18     say state switch unicode_strings
+            unicode_eval evalbytes current_sub fc
+
 The C<:default> bundle represents the feature set that is enabled before
 any C<use feature> or C<no feature> declaration.
 
index 1c91fa2..15315c7 100755 (executable)
@@ -37,19 +37,16 @@ my %feature = (
 #       versions, any code below that uses %BundleRanges will have to
 #       be changed to account.
 
+# 5.odd implies the next 5.even, but an explicit 5.even can override it.
 my %feature_bundle = (
      all     => [ keys %feature ],
      default =>        [qw(array_base)],
     "5.9.5"  =>        [qw(say state switch array_base)],
     "5.10"   =>        [qw(say state switch array_base)],
     "5.11"   =>        [qw(say state switch unicode_strings array_base)],
-    "5.12"   =>        [qw(say state switch unicode_strings array_base)],
     "5.13"   =>        [qw(say state switch unicode_strings array_base)],
-    "5.14"   =>        [qw(say state switch unicode_strings array_base)],
     "5.15"   =>        [qw(say state switch unicode_strings unicode_eval
                    evalbytes current_sub fc)],
-    "5.16"   =>        [qw(say state switch unicode_strings unicode_eval
-                   evalbytes current_sub fc)],
     "5.17"   =>        [qw(say state switch unicode_strings unicode_eval
                    evalbytes current_sub fc)],
 );
@@ -58,6 +55,11 @@ my %feature_bundle = (
 ###########################################################################
 # More data generated from the above
 
+for (keys %feature_bundle) {
+    next unless /^5\.(\d*[13579])\z/;
+    $feature_bundle{"5.".($1+1)} ||= $feature_bundle{$_};
+}
+
 my %UniqueBundles; # "say state switch" => 5.10
 my %Aliases;       #  5.12 => 5.11
 for( sort keys %feature_bundle ) {