line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Normal::Config::TitleStem; |
2
|
9
|
|
|
9
|
|
31
|
use strict; |
|
9
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
188
|
|
3
|
9
|
|
|
9
|
|
28
|
use warnings; |
|
9
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
154
|
|
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
26
|
use String::Normal::Config; |
|
9
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
906
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub _data { |
8
|
1
|
|
|
1
|
|
3
|
my %params = @_; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
1
|
my $fh; |
11
|
1
|
50
|
|
|
|
3
|
if ($params{title_stem}) { |
12
|
0
|
0
|
|
|
|
0
|
open $fh, $params{title_stem} or die "Can't read '$params{title_stem}' $!\n"; |
13
|
|
|
|
|
|
|
} else { |
14
|
1
|
|
|
|
|
4
|
$fh = *DATA; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
5
|
my %stem = String::Normal::Config::_slurp( $fh ); |
18
|
1
|
|
|
|
|
5
|
return \%stem; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
String::Normal::Config::TitleStem; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This package defines substitutions to be performed on Title types. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 STRUCTURE |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
One entry pair per line: first the value to be matched then the value |
34
|
|
|
|
|
|
|
to be changed to. For example: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
foo fu |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Would change all occurances of C to C. See C<__DATA__> block below. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
You can provide your own data by creating a text file containing your |
41
|
|
|
|
|
|
|
values and provide the path to that file via the constructor: |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $normalizer = String::Normal->new( title_stem => '/path/to/values.txt' ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Jeff Anderson, C<< >> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Copyright 2017 Jeff Anderson. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
54
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
55
|
|
|
|
|
|
|
copy of the full license at: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
60
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
61
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
62
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
65
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
66
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
69
|
|
|
|
|
|
|
mark, tradename, or logo of the Copyright Holder. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
72
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
73
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
74
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
75
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
76
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
77
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
78
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
81
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
82
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
83
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
84
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
85
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
86
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
87
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__DATA__ |