| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
4
|
|
|
4
|
|
74
|
use 5.010; |
|
|
4
|
|
|
|
|
18
|
|
|
2
|
4
|
|
|
4
|
|
32
|
use strict; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
177
|
|
|
3
|
4
|
|
|
4
|
|
27
|
use warnings; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
486
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package String::Compile::Tr::Overload; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=encoding UTF-8 |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
String::Compile::Tr::Overload - overload tr/// operands |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.06 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our |
|
20
|
|
|
|
|
|
|
$VERSION = '0.06'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use String::Compile::Tr::Overload; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
This module overloads the operands of a C |
operator and replaces
|
29
|
|
|
|
|
|
|
the strings C<:search:> and C<:replace:> with the contents of the |
|
30
|
|
|
|
|
|
|
variables C<$String::Compile::Tr::Overload::search> resp. |
|
31
|
|
|
|
|
|
|
C<$String::Compile::Tr::Overload::replace>. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 AUTHOR |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Jörg Sommrey, C<< >> |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This software is copyright (c) 2025 by Jörg Sommrey. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
42
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
L |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
4
|
|
|
4
|
|
756
|
use overload; |
|
|
4
|
|
|
|
|
2258
|
|
|
|
4
|
|
|
|
|
37
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _ovl_tr { |
|
53
|
36
|
|
|
36
|
|
911
|
our ($search, $replace); |
|
54
|
|
|
|
|
|
|
|
|
55
|
36
|
100
|
|
|
|
1240
|
return $_[1] unless $_[2] eq 'tr'; |
|
56
|
12
|
100
|
|
|
|
64
|
return "$search" if $_[1] eq ':search:'; |
|
57
|
6
|
50
|
|
|
|
1112
|
return "$replace" if $_[1] eq ':replace:'; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
0
|
$_[1]; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub import { |
|
63
|
4
|
|
|
4
|
|
22
|
overload::constant q => \&_ovl_tr; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub unimport { |
|
67
|
0
|
|
|
0
|
|
|
overload::remove_constant q => \&_ovl_tr; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |