Skip to content

Commit

Permalink
support perl 5.14+, that is "Stringification of regexes has changed".
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Jul 25, 2011
1 parent 4e7d088 commit 43fe5a9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Lingua/JA/Kana.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use utf8;

our $VERSION = sprintf "%d.%02d", q$Revision: 0.5 $ =~ /(\d+)/g;

use re ();
require Exporter;
use base qw/Exporter/;
our @EXPORT = qw(
Expand Down Expand Up @@ -121,8 +122,13 @@ our $Re_Romaji2Kata = do {
my $ra = Regexp::Assemble->new();
$ra->add($_) for keys %Romaji2Kata;
my $str = $ra->re;
substr( $str, 0, 8, '' ); # remove '(?-xism:'
substr( $str, -1, 1, '' ); # and ')';
if ($] >= 5.009005) {
my ($pattern, $mod) = re::regexp_pattern($str);
$str = $pattern;
} else {
substr( $str, 0, 8, '' ); # remove '(?-xism:'
substr( $str, -1, 1, '' ); # and ')';
}
qr/$str/i; # and recompile with i
}
else {
Expand Down

0 comments on commit 43fe5a9

Please sign in to comment.