diff options
-rw-r--r-- | lib/feature.pm | 15 | ||||
-rwxr-xr-x | regen/feature.pl | 15 | ||||
-rw-r--r-- | t/lib/feature/bundle | 24 |
3 files changed, 38 insertions, 16 deletions
diff --git a/lib/feature.pm b/lib/feature.pm index fe88c8c47d..33f48dc021 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -5,7 +5,7 @@ package feature; -our $VERSION = '1.26'; +our $VERSION = '1.27'; our %feature = ( fc => 'feature_fc', @@ -23,6 +23,7 @@ our %feature_bundle = ( "5.10" => [qw(array_base say state switch)], "5.11" => [qw(array_base say state switch unicode_strings)], "5.15" => [qw(current_sub evalbytes fc say state switch unicode_eval unicode_strings)], + "all" => [qw(array_base current_sub evalbytes fc say state switch unicode_eval unicode_strings)], "default" => [qw(array_base)], ); @@ -98,7 +99,8 @@ has lexical effect. } say "Yet it is here."; -C<no feature> with no features specified will turn off all features. +C<no feature> with no features specified will reset to the default group. To +disable I<all> features (an unusual request!) use C<no feature ':all'>. =head1 AVAILABLE FEATURES @@ -277,7 +279,7 @@ the C<use VERSION> construct. That is, will do an implicit - no feature; + no feature ':all'; use feature ':5.10'; and so on. Note how the trailing sub-version @@ -351,11 +353,10 @@ sub unimport { normalise_hints $features; } - # A bare C<no feature> should disable *all* features + # A bare C<no feature> should reset to the default bundle if (!@_) { - delete @^H{ values(%feature) }; - $^H &= ~ $hint_uni8bit; - return; + $^H &= ~($hint_uni8bit|$hint_mask); + return; } while (@_) { diff --git a/regen/feature.pl b/regen/feature.pl index 445c8b3a6e..f362396943 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -38,6 +38,7 @@ my %feature = ( # be changed to account. 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)], @@ -331,7 +332,7 @@ read_only_bottom_close_and_rename($h); __END__ package feature; -our $VERSION = '1.26'; +our $VERSION = '1.27'; FEATURES @@ -392,7 +393,8 @@ has lexical effect. } say "Yet it is here."; -C<no feature> with no features specified will turn off all features. +C<no feature> with no features specified will reset to the default group. To +disable I<all> features (an unusual request!) use C<no feature ':all'>. =head1 AVAILABLE FEATURES @@ -561,7 +563,7 @@ the C<use VERSION> construct. That is, will do an implicit - no feature; + no feature ':all'; use feature ':5.10'; and so on. Note how the trailing sub-version @@ -635,11 +637,10 @@ sub unimport { normalise_hints $features; } - # A bare C<no feature> should disable *all* features + # A bare C<no feature> should reset to the default bundle if (!@_) { - delete @^H{ values(%feature) }; - $^H &= ~ $hint_uni8bit; - return; + $^H &= ~($hint_uni8bit|$hint_mask); + return; } while (@_) { diff --git a/t/lib/feature/bundle b/t/lib/feature/bundle index 7e1479f4e3..429e68ebd0 100644 --- a/t/lib/feature/bundle +++ b/t/lib/feature/bundle @@ -85,9 +85,9 @@ no feature; use feature ":default"; $[ = 1; print qw[a b c][2], "\n"; -use feature ":5.16"; # should not disable anything; no feature does that +use feature ":5.16"; # should not disable anything; no feature ':all' does that print qw[a b c][2], "\n"; -no feature; +no feature ':all'; print qw[a b c][2], "\n"; use feature ":5.16"; print qw[a b c][2], "\n"; @@ -97,3 +97,23 @@ b b c c +######## +# "no feature" +use feature ':5.16'; # turns array_base off +no feature; # resets to :default, thus turns array_base on +$[ = 1; +print qw[a b c][2], "\n"; +EXPECT +Use of assignment to $[ is deprecated at - line 4. +b +######## +# "no feature 'all" +$[ = 1; +print qw[a b c][2], "\n"; +no feature ':all'; # turns array_base (and everything else) off +$[ = 1; +print qw[a b c][2], "\n"; +EXPECT +Use of assignment to $[ is deprecated at - line 2. +Assigning non-zero to $[ is no longer possible at - line 5. +b |