| 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
| |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | @post= map{blessed($_)?$_->as_string:$_}@post; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | my $pretxt = join '',@pre; | |||||||||||||||||||||||||||
| 22 | 0 | my $posttxt = join '',@post; | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | $pretxt .= '' if $pretxt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $posttxt = ''.$posttxt if $posttxt; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if( $pretxt eq '' || $posttxt eq '' ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pretxt eq "" or $posttxt eq ""
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 ""
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||