diff --git a/lib/Lingua/JA/Kana.pm b/lib/Lingua/JA/Kana.pm index 4f73c23..8ae9466 100644 --- a/lib/Lingua/JA/Kana.pm +++ b/lib/Lingua/JA/Kana.pm @@ -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( @@ -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 {