File Coverage

blib/lib/Regexp/Common/lingua.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 23 23 100.0


line stmt bran cond sub pod time code
1             package Regexp::Common::lingua;
2              
3 72     72   983 use 5.10.0;
  72         331  
4              
5 72     72   440 use strict;
  72         201  
  72         1547  
6 72     72   360 use warnings;
  72         267  
  72         1959  
7 72     72   356 no warnings 'syntax';
  72         151  
  72         2648  
8              
9 72     72   478 use Regexp::Common qw /pattern clean no_defaults/;
  72         156  
  72         1549  
10              
11             our $VERSION = '2017060201';
12              
13              
14             pattern name => [qw /lingua palindrome -chars=[A-Za-z]/],
15             create => sub {
16 72     72   542 use re 'eval';
  72         164  
  72         10461  
17             my $keep = exists $_ [1] -> {-keep};
18             my $ch = $_ [1] -> {-chars};
19             my $idx = $keep ? "1:$ch" : "0:$ch";
20             my $r = "(??{\$Regexp::Common::lingua::pd{'" . $idx . "'}})";
21             $Regexp::Common::lingua::pd {$idx} =
22             $keep ? qr /($ch|($ch)($r)?\2)/ : qr /$ch|($ch)($r)?\1/;
23             # print "[$ch]: ", $Regexp::Common::lingua::pd {$idx}, "\n";
24             # $Regexp::Common::lingua::pd {$idx};
25             },
26             ;
27              
28              
29             1;
30              
31             __END__