This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't use a regex match in lib/feature.pm
authorÆvar Arnfjörð Bjarmason <avar@cpan.org>
Fri, 18 May 2007 20:16:53 +0000 (20:16 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sun, 20 May 2007 12:48:01 +0000 (12:48 +0000)
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Message-ID: <51dd1af80705181316r15f65e45n55903de294565aa1@mail.gmail.com>

p4raw-id: //depot/perl@31241

lib/feature.pm

index 7a88b15..f33ce2d 100644 (file)
@@ -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})) {