summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Mengué <dolmen@cpan.org>2016-03-30 23:13:17 +0200
committerOlivier Mengué <dolmen@cpan.org>2016-03-30 23:13:17 +0200
commite18489a1f13ca6ee9adfe9791a0a05e90feafb0f (patch)
tree22216bb717941856ba30f29b88d5fe977cf4dae5
parentcb0abffcf60e745e24d5b9852531c76f64ac4558 (diff)
downloadeval-closure-e18489a1f13ca6ee9adfe9791a0a05e90feafb0f.tar.gz
eval-closure-e18489a1f13ca6ee9adfe9791a0a05e90feafb0f.zip
Use index() instead of regexp
-rw-r--r--lib/Eval/Closure.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm
index e129c53..868e4a8 100644
--- a/lib/Eval/Closure.pm
+++ b/lib/Eval/Closure.pm
@@ -171,11 +171,11 @@ sub _validate_env {
for my $var (keys %$env) {
if (HAS_LEXICAL_SUBS) {
croak("Environment key '$var' should start with \@, \%, \$, or \&")
- unless $var =~ /^([\@\%\$\&])/;
+ if index('$@%&', substr($var, 0, 1)) < 0;
}
else {
croak("Environment key '$var' should start with \@, \%, or \$")
- unless $var =~ /^([\@\%\$])/;
+ if index('$@%', substr($var, 0, 1)) < 0;
}
croak("Environment values must be references, not $env->{$var}")
unless ref($env->{$var});