|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package ReplaceMultiple;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
27753
 | 
 use strict;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
54
 | 
    | 
| 
4
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
7
 | 
 use warnings;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
492
 | 
    | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $VERSION = 1.01;  | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our (@ISA, @EXPORT);  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 require Exporter; @ISA = qw(Exporter);  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 @EXPORT = qw(replace_multiple_inplace replace_multiple);  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub replace_multiple_inplace {  | 
| 
13
 | 
0
 | 
 
 | 
 
 | 
  
0
  
 | 
  
0
  
 | 
0
 | 
   my ($hash, $str_ref) = @_;  | 
| 
14
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $obj = ReplaceMultiple->new($hash);  | 
| 
15
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   return $obj->apply_inplace($str_ref);  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub replace_multiple {  | 
| 
19
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
16
 | 
   my ($hash, $str) = @_;  | 
| 
20
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
   my $obj = ReplaceMultiple->new($hash);  | 
| 
21
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
   return $obj->apply($str);  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
25
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
2
 | 
   my ($class, $hash) = @_;  | 
| 
26
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
   my $re_str = "(" . (join '|', map { "\Q$_\E" } keys %$hash) . ")";  | 
| 
 
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
27
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
51
 | 
   my $self = bless {HASH=>$hash, RE=>qr/$re_str/}, $class;  | 
| 
28
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
   return $self;  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub apply_inplace {  | 
| 
32
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
3
 | 
   my ($self, $str_ref) = @_;  | 
| 
33
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
   $$str_ref =~ s/$self->{RE}/$self->{HASH}{$1}/g;  | 
| 
34
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
   return $$str_ref;  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub apply {  | 
| 
38
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
3
 | 
   my ($self, $str) = @_;  | 
| 
39
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
   my $str2 = $str;  | 
| 
40
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
   return $self->apply_inplace(\$str2);  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
43
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  |