| 1 | package Babble::SubMatch; | ||||||||||
| 2 | |||||||||||
| 3 | 12 | ▶ | use Mu; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 12 | extends 'Babble::Match'; | |||||||||
| 6 | |||||||||||
| 7 | 12 | ro 'parent'; | |||||||||
| 8 | 12 | ro 'start'; | |||||||||
| 9 | |||||||||||
| 10 | 190 | ▶ | sub replace_text { | ||||||||
|
Subroutine
replace_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 11 | 190 | my ($self, $new_text) = @_; | |||||||||
| 12 | 190 | $self->replace_substring(0, length($self->text), $new_text); | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 32 | ▶ | sub transform_text { | ||||||||
|
Subroutine
transform_text: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 16 | 32 | my ($self, $code) = @_; | |||||||||
| 17 | 32 | local $_ = my $text = $self->text; | |||||||||
| 18 | 32 | $code->($_); | |||||||||
| 19 | 32 | ▶ | if ($_ ne $text) { $self->replace_text($_) } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 32 | return $self; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 364 | ▶ | before replace_substring => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 364 | my ($self, $start, $length, $new_text) = @_; | |||||||||
| 25 | 364 | $self->parent | |||||||||
| 26 | ->replace_substring($self->start + $start, $length, $new_text); | ||||||||||
| 27 | 12 | }; | |||||||||
| 28 | |||||||||||
| 29 | 12 | 1; | |||||||||