Common/lingua.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 36 / 36 CC 3 SCAR 5.1
CC
3
Cov
100%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Common/URI/gopher.pm ↑ Summary Common/list.pm »
1 package Regexp::Common::lingua;
2  
3 71 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 71 ▶no warnings 'syntax';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 71 ▶use Regexp::Common qw /pattern clean no_defaults/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 71 our $VERSION = '2024080801';
12  
13  
14 pattern name => [qw /lingua palindrome -chars=[A-Za-z]/],
15 10 ▶ create => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
16 71 ▶ use re 'eval';
Subroutine BEGIN: called CC=1 SCAR=0.0
17 10 my $keep = exists $_ [1] -> {-keep};
18 10 my $ch = $_ [1] -> {-chars};
19 10 ▶ my $idx = $keep ? "1:$ch" : "0:$ch";
Branch: 1 branch
BranchTrueFalseTotal
$keep ? : 4 6 10
20 10 my $r = "(??{\$Regexp::Common::lingua::pd{'" . $idx . "'}})";
21 10 ▶ $Regexp::Common::lingua::pd {$idx} =
Branch: 1 branch
BranchTrueFalseTotal
$keep ? : 4 6 10
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 71 ;
27  
28  
29 71 1;
30  
31 __END__
« Common/URI/gopher.pm ↑ Summary Common/list.pm »