From: Ævar Arnfjörð Bjarmason Date: Fri, 18 May 2007 20:16:53 +0000 (+0000) Subject: Don't use a regex match in lib/feature.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7be54ea7d51824e3590034a7880ff325459e8d52;p=p5sagit%2Fp5-mst-13.2.git Don't use a regex match in lib/feature.pm From: "Ævar Arnfjörð Bjarmason" Message-ID: <51dd1af80705181316r15f65e45n55903de294565aa1@mail.gmail.com> p4raw-id: //depot/perl@31241 --- diff --git a/lib/feature.pm b/lib/feature.pm index 7a88b15..f33ce2d 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -151,11 +151,11 @@ sub import { } while (@_) { my $name = shift(@_); - if ($name =~ /^:(.*)/) { - if (!exists $feature_bundle{$1}) { - unknown_feature_bundle($1); + if (substr($name, 0, 1) eq ":" and (my $v = substr($name, 1))) { + if (!exists $feature_bundle{$v}) { + unknown_feature_bundle($v); } - unshift @_, @{$feature_bundle{$1}}; + unshift @_, @{$feature_bundle{$v}}; next; } if (!exists $feature{$name}) { @@ -176,11 +176,11 @@ sub unimport { while (@_) { my $name = shift; - if ($name =~ /^:(.*)/) { - if (!exists $feature_bundle{$1}) { - unknown_feature_bundle($1); + if (substr($name, 0, 1) eq ":" and (my $v = substr($name, 1))) { + if (!exists $feature_bundle{$v}) { + unknown_feature_bundle($v); } - unshift @_, @{$feature_bundle{$1}}; + unshift @_, @{$feature_bundle{$v}}; next; } if (!exists($feature{$name})) {