File Coverage

blib/lib/Babble/SubMatch.pm
Criterion Covered Total %
statement 11 11 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 0 2 0.0
total 15 18 83.3


line stmt bran cond sub pod time code
1             package Babble::SubMatch;
2              
3 12     12   151 use Mu;
  12         37  
  12         123  
4              
5             extends 'Babble::Match';
6              
7             ro 'parent';
8             ro 'start';
9              
10             sub replace_text {
11 190     190 0 396343 my ($self, $new_text) = @_;
12 190         4570 $self->replace_substring(0, length($self->text), $new_text);
13             }
14              
15             sub transform_text {
16 32     32 0 89 my ($self, $code) = @_;
17 32         115 local $_ = my $text = $self->text;
18 32         111 $code->($_);
19 32 50       299 if ($_ ne $text) { $self->replace_text($_) }
  32         90  
20 32         507 return $self;
21             }
22              
23             before replace_substring => sub {
24             my ($self, $start, $length, $new_text) = @_;
25             $self->parent
26             ->replace_substring($self->start + $start, $length, $new_text);
27             };
28              
29             1;