diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-06-20 13:13:02 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-06-20 13:30:45 -0600 |
commit | 48895a0d16aef33c200bc9a07f22e18c23597c2a (patch) | |
tree | 55d14a1da67f4ea8157f175a4fc3aa754c53463c /ext | |
parent | e96e08341b9c33cd81378d315edb5940c226c451 (diff) | |
download | perl-48895a0d16aef33c200bc9a07f22e18c23597c2a.tar.gz |
PATCH: [perl #113750] re.pm clobbers $_
Thanks to Jesse Luehrs and Father Chrysostomos for testing advice.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/re/re.pm | 4 | ||||
-rw-r--r-- | ext/re/t/re.t | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ext/re/re.pm b/ext/re/re.pm index 75452b8a45..1242595386 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -4,7 +4,7 @@ package re; use strict; use warnings; -our $VERSION = "0.20"; +our $VERSION = "0.21"; our @ISA = qw(Exporter); our @EXPORT_OK = ('regmust', qw(is_regexp regexp_pattern @@ -142,7 +142,7 @@ sub bits { my $reflags = $^H{reflags} || 0; my $seen_charset; while ($s =~ m/( . )/gx) { - $_ = $1; + local $_ = $1; if (/[adul]/) { # The 'a' may be repeated; hide this from the rest of the # code by counting and getting rid of all of them, then diff --git a/ext/re/t/re.t b/ext/re/t/re.t index 5fbf3fd27e..13498bbe2d 100644 --- a/ext/re/t/re.t +++ b/ext/re/t/re.t @@ -10,7 +10,7 @@ BEGIN { use strict; -use Test::More tests => 14; +use Test::More tests => 15; require_ok( 're' ); # setcolor @@ -63,6 +63,11 @@ my $ok='foo'=~/$reg/; eval"no re Debug=>'ALL'"; ok( $ok, 'No segv!' ); +my $message = "Don't tread on me"; +$_ = $message; +re->import("/aa"); +is($_, $message, "re doesn't clobber \$_"); + package Term::Cap; sub Tgetent { |