Reverse/Converter/Regexp.pm

filter: Statementstmt 34.3% 11 / 32 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 26.9% 14 / 52 SCAR 35.7
CC
8
Cov
24%
Convert
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 35.6
↑ Summary Reverse.pm »
1 package Template::Reverse::Converter::Regexp;
2  
3 # ABSTRACT: Convert parts to Regular Expression simply
4  
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 our $VERSION = '0.143'; # VERSION
9  
10 sub Convert{
11 0 ▶ my $self = shift;
Subroutine Convert: not called CC=8 SCAR=42.8
Pod undocumented
12 0 my $parts = shift;
13 0 my @temps;
14  
15 0 foreach my $pat (@{$parts}){
16 0 my @pre = @{$pat->pre};
17 0 my @post = @{$pat->post};
18  
19 0 ▶ @pre = map{blessed($_)?$_->as_string:$_}@pre;
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($_) ? : 0 0 0
20 0 ▶ @post= map{blessed($_)?$_->as_string:$_}@post;
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($_) ? : 0 0 0
21 0 my $pretxt = join '',@pre;
22 0 my $posttxt = join '',@post;
23 0 ▶ $pretxt .= '' if $pretxt;
Branch: 1 branch
BranchTrueFalseTotal
if $pretxt 0 0 0
24 0 ▶ $posttxt = ''.$posttxt if $posttxt;
Branch: 1 branch
BranchTrueFalseTotal
if $posttxt 0 0 0
25  
26 0 ▶ if( $pretxt eq '' || $posttxt eq '' ){
Branch: 1 branch
BranchTrueFalseTotal
if ($pretxt eq '' or $posttxt eq '') { } 0 0 0
Condition0%0/3
$pretxt eq "" or $posttxt eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
$pretxt eq "" or $posttxt eq ""
$pretxt eq "" $posttxt eq ""
Truth table0%0/3
A or B
A= $pretxt eq ""B= $posttxt eq ""
ABresult
1X1
011
000
27 0 push(@temps,qr!\Q$pretxt\E(.+)\Q$posttxt\E!);
28 }
29 else{
30 0 push(@temps,qr!\Q$pretxt\E(.+?)\Q$posttxt\E!);
31 }
32 }
33  
34 0 return \@temps;
35 }
36  
37  
38  
39 1 1;
40  
41 __END__
↑ Summary Reverse.pm »