tools/mkcharinfo: silence warnings in perl 5.18
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 10 Feb 2015 04:26:34 +0000 (05:26 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 13 Feb 2015 16:43:00 +0000 (17:43 +0100)
tools/mkcharinfo

index 577ffb17b65cfaaa30640df2754d5bb5796c2475..b673105339f79357b741efc19c8e671eb3b24680 100755 (executable)
@@ -3,6 +3,7 @@ use 5.010;
 use strict;
 use warnings;
 use utf8;
+no if $] >= 5.018, warnings => 'experimental::smartmatch';
 
 use open OUT => ':utf8', ':std';
 use Data::Dump 'pp';
@@ -32,7 +33,9 @@ eval {
 
 eval {
        require HTML::Entities;
-       while (my ($char, $entity) = each %HTML::Entities::char2entity) {
+       our %char2entity;
+       HTML::Entities->import('%char2entity');
+       while (my ($char, $entity) = each %char2entity) {
                $entity =~ /[a-zA-Z]/ or next;  # only actual aliases
                $info{$char}->{html} = substr($entity, 1, -1);
        }
@@ -115,7 +118,7 @@ for my $cp (sort keys %info) {
 say '}';
 
 sub escapeq {
-       my $_ = shift;
+       local $_ = shift;
        return 'undef' if not defined;
        s/(['\\])/\\$1/g;
        return "'$_'";