summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-02-27 17:57:54 +0100
committerNicholas Clark <nick@ccl4.org>2012-03-19 10:21:54 +0100
commit36143a0c55b8cfba5c5c2c2b40c5e00bce067bf2 (patch)
tree9d5f9273723384f7d067ebd844c4e98c2b400c28 /lib
parent1873980aaeb3ef1e5a2e1ef646a831ce8ddc3e11 (diff)
downloadperl-36143a0c55b8cfba5c5c2c2b40c5e00bce067bf2.tar.gz
In feature.pm, use a consistent code style in import() and unimport().
There were a couple of inconsistencies (shift with/without an explicit @_, exists with/without(), !@_ vs @_ == 0) which turn out to date back to before 5.10.0 Also fix an inadvertent use of a single element array slice with a simple array lookup in current_bundle().
Diffstat (limited to 'lib')
-rw-r--r--lib/feature.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/feature.pm b/lib/feature.pm
index 58380e9db6..bc323282f3 100644
--- a/lib/feature.pm
+++ b/lib/feature.pm
@@ -302,7 +302,7 @@ bundle is automatically loaded instead.
sub current_bundle {
my $bundle_number = $^H & $hint_mask;
return if $bundle_number == $hint_mask;
- return $feature_bundle{@hint_bundles[$bundle_number >> $hint_shift]};
+ return $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]};
}
sub normalise_hints {
@@ -317,15 +317,17 @@ sub normalise_hints {
sub import {
my $class = shift;
- if (@_ == 0) {
+
+ if (!@_) {
croak("No features specified");
}
+
if (my $features = current_bundle) {
# Features are enabled implicitly via bundle hints.
normalise_hints $features;
}
while (@_) {
- my $name = shift(@_);
+ my $name = shift;
if (substr($name, 0, 1) eq ":") {
my $v = substr($name, 1);
if (!exists $feature_bundle{$v}) {
@@ -358,7 +360,6 @@ sub unimport {
# Features are enabled implicitly via bundle hints.
normalise_hints $features;
}
-
while (@_) {
my $name = shift;
if (substr($name, 0, 1) eq ":") {
@@ -372,7 +373,7 @@ sub unimport {
unshift @_, @{$feature_bundle{$v}};
next;
}
- if (!exists($feature{$name})) {
+ if (!exists $feature{$name}) {
unknown_feature($name);
}
else {