Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

re.pm in 5.14.0~5.16.0 clobbers $_, this is a workaround for this issue.

  • Loading branch information...
commit 22552208fa5ddce9527fb3194051da4a60a8734f 1 parent 3d25579
@tokuhirom tokuhirom authored
Showing with 23 additions and 2 deletions.
  1. +9 −2 lib/Encode/JP/Mobile/Charnames.pm
  2. +14 −0 t/charnames-clobber-it.t
View
11 lib/Encode/JP/Mobile/Charnames.pm
@@ -14,8 +14,15 @@ our @EXPORT_OK = qw( unicode2name unicode2name_en vianame );
my $name2unicode;
{
- use charnames ':full';
- BEGIN { *_def_translator = $^H{charnames} }
+ # re.pm clobbers $_ in 5.14.0 ~ 5.16.0
+ # and charnames.pm requires re.pm
+ # ref. https://github.com/mirrors/perl/commit/48895a0d
+ BEGIN {
+ local $_;
+ require charnames;
+ charnames->import(':full');
+ *_def_translator = $^H{charnames}
+ }
}
View
14 t/charnames-clobber-it.t
@@ -0,0 +1,14 @@
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+
+# re.pm clobbers $_ in 5.14.0 ~ 5.16.0
+# ref. https://github.com/mirrors/perl/commit/48895a0d
+
+$_ = "Do not edit this variable";
+require Encode::JP::Mobile::Charnames;
+is($_, "Do not edit this variable");
+
+done_testing;
+
Please sign in to comment.
Something went wrong with that request. Please try again.