line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Reverse::Converter::Regexp; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Convert parts to Regular Expression simply |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
944
|
use Moo; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
13
|
|
6
|
1
|
|
|
1
|
|
461
|
use utf8; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.202'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub Convert{ |
10
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
11
|
0
|
|
|
|
|
|
my $parts = shift; |
12
|
0
|
|
|
|
|
|
my @temps; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
foreach my $pat (@{$parts}){ |
|
0
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my @pre = @{$pat->{pre}}; |
|
0
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my @post = @{$pat->{post}}; |
|
0
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
@pre = grep{!ref($_)}@pre; |
|
0
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
@post= grep{!ref($_)}@post; |
|
0
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $pretxt = join '',@pre; |
21
|
0
|
|
|
|
|
|
my $posttxt = join '',@post; |
22
|
0
|
0
|
|
|
|
|
$pretxt .= '' if $pretxt; |
23
|
0
|
0
|
|
|
|
|
$posttxt = ''.$posttxt if $posttxt; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
0
|
|
|
|
if( $pretxt eq '' || $posttxt eq '' ){ |
26
|
0
|
|
|
|
|
|
push(@temps,qr!\Q$pretxt\E(.+)\Q$posttxt\E!); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else{ |
29
|
0
|
|
|
|
|
|
push(@temps,qr!\Q$pretxt\E(.+?)\Q$posttxt\E!); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return \@temps; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |