line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Replacer::Replacement; |
2
|
98
|
|
|
98
|
|
547
|
use strict; |
|
98
|
|
|
|
|
190
|
|
|
98
|
|
|
|
|
2250
|
|
3
|
98
|
|
|
98
|
|
412
|
use utf8; |
|
98
|
|
|
|
|
175
|
|
|
98
|
|
|
|
|
545
|
|
4
|
98
|
|
|
98
|
|
2023
|
use warnings FATAL => 'all'; |
|
98
|
|
|
|
|
1116
|
|
|
98
|
|
|
|
|
19622
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new |
7
|
|
|
|
|
|
|
{ |
8
|
713
|
|
|
713
|
0
|
1306
|
my $proto = shift; |
9
|
713
|
|
|
|
|
1172
|
my $expression = shift; |
10
|
|
|
|
|
|
|
|
11
|
713
|
|
|
|
|
1206
|
my $blocksep = ''; |
12
|
713
|
|
|
|
|
1203
|
my $block_num = 0; |
13
|
713
|
|
66
|
|
|
2493
|
while( not $blocksep or $expression =~ /$blocksep/ ) |
14
|
|
|
|
|
|
|
{ |
15
|
713
|
|
|
|
|
6891
|
$blocksep = sprintf '_BL_%s_', $block_num++; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
713
|
|
|
|
|
3110
|
my $self = bless { |
19
|
|
|
|
|
|
|
block_counter => 0 |
20
|
|
|
|
|
|
|
, block_ph => $blocksep.'%s_' |
21
|
|
|
|
|
|
|
, blocks => { } |
22
|
|
|
|
|
|
|
}, $proto; |
23
|
|
|
|
|
|
|
|
24
|
713
|
|
|
|
|
2879
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub add_replacement |
28
|
|
|
|
|
|
|
{ |
29
|
225
|
|
|
225
|
0
|
462
|
my $self = shift; |
30
|
225
|
|
|
|
|
361
|
my $value = shift; |
31
|
|
|
|
|
|
|
|
32
|
225
|
|
|
|
|
882
|
my $key = sprintf $self->{block_ph}, $self->{block_counter}++; |
33
|
225
|
|
|
|
|
600
|
$self->{blocks}->{$key} = $value; |
34
|
|
|
|
|
|
|
|
35
|
225
|
|
|
|
|
1111
|
return $key; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub get_replacement |
39
|
|
|
|
|
|
|
{ |
40
|
2088
|
|
|
2088
|
0
|
3361
|
my $self = shift; |
41
|
2088
|
|
|
|
|
3177
|
my $key = shift; |
42
|
2088
|
|
|
|
|
3048
|
my $value = undef; |
43
|
|
|
|
|
|
|
|
44
|
2088
|
100
|
|
|
|
5157
|
if (exists $self->{blocks}->{$key}) |
45
|
|
|
|
|
|
|
{ |
46
|
223
|
|
|
|
|
429
|
$value = $self->{blocks}->{$key}; |
47
|
223
|
|
|
|
|
542
|
delete $self->{blocks}->{$key}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
2088
|
|
|
|
|
9035
|
return $value; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |