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   618 use 5.10.0;
  72         153  
4              
5 72     72   254 use strict;
  72         85  
  72         1250  
6 72     72   220 use warnings;
  72         70  
  72         1706  
7 72     72   210 no warnings 'syntax';
  72         92  
  72         2815  
8              
9 72     72   829 use Regexp::Common qw /pattern clean no_defaults/;
  72         209  
  72         426  
10              
11             our $VERSION = '2017040401';
12              
13              
14             pattern name => [qw /lingua palindrome -chars=[A-Za-z]/],
15             create => sub {
16 72     72   360 use re 'eval';
  72         791  
  72         9412  
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__