File Coverage

blib/lib/String/Normal/Config/TitleStop.pm
Criterion Covered Total %
statement 19 20 95.0
branch 1 4 25.0
condition 1 2 50.0
subroutine 4 4 100.0
pod n/a
total 25 30 83.3


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