File Coverage

blib/lib/Tail/Tool/Plugin/Ignore.pm
Criterion Covered Total %
statement 24 24 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 6 6 100.0
pod 1 1 100.0
total 35 36 97.2


line stmt bran cond sub pod time code
1             package Tail::Tool::Plugin::Ignore;
2              
3             # Created on: 2010-10-06 14:16:02
4             # Create by: Ivan Wills
5             # $Id$
6             # $Revision$, $HeadURL$, $Date$
7             # $Revision$, $Source$, $Date$
8              
9 2     2   2397 use Moose;
  2         292242  
  2         13  
10 2     2   9580 use warnings;
  2         3  
  2         59  
11 2     2   612 use version;
  2         1497  
  2         15  
12 2     2   108 use Carp;
  2         2  
  2         131  
13 2     2   399 use English qw/ -no_match_vars /;
  2         1431  
  2         13  
14              
15             extends 'Tail::Tool::PreProcess';
16             with 'Tail::Tool::RegexList';
17              
18             our $VERSION = version->new('0.4.7');
19              
20             sub process {
21 2     2 1 638 my ($self, $line) = @_;
22 2         2 my $matches;
23              
24 2         3 for my $match ( @{ $self->regex } ) {
  2         56  
25 2         41 $matches += $match->enabled;
26 2         40 my $reg = $match->regex;
27 2 100 66     38 if ( $match->enabled && $line =~ /$reg/ ) {
28             # return empty as the line is to be ignored
29 1         3 return ();
30             }
31             }
32              
33             # return empty array if there were enabled matches else return the line
34 1         3 return ($line);
35             }
36              
37             1;
38              
39             __END__
40              
41             =head1 NAME
42              
43             Tail::Tool::Plugin::Ignore - <One-line description of module's purpose>
44              
45             =head1 VERSION
46              
47             This documentation refers to Tail::Tool::Plugin::Ignore version 0.4.7.
48              
49              
50             =head1 SYNOPSIS
51              
52             use Tail::Tool::Plugin::Ignore;
53              
54             # Brief but working code example(s) here showing the most common usage(s)
55             # This section will be as far as many users bother reading, so make it as
56             # educational and exemplary as possible.
57              
58              
59             =head1 DESCRIPTION
60              
61             A full description of the module and its features.
62              
63             May include numerous subsections (i.e., =head2, =head3, etc.).
64              
65              
66             =head1 SUBROUTINES/METHODS
67              
68             =head2 C<process ($line)>
69              
70             Param: C<$line> -The line to process
71              
72             Decides if the line should be displayed.
73              
74             =head1 DIAGNOSTICS
75              
76             A list of every error and warning message that the module can generate (even
77             the ones that will "never happen"), with a full explanation of each problem,
78             one or more likely causes, and any suggested remedies.
79              
80             =head1 CONFIGURATION AND ENVIRONMENT
81              
82             A full explanation of any configuration system(s) used by the module, including
83             the names and locations of any configuration files, and the meaning of any
84             environment variables or properties that can be set. These descriptions must
85             also include details of any configuration language used.
86              
87             =head1 DEPENDENCIES
88              
89             A list of all of the other modules that this module relies upon, including any
90             restrictions on versions, and an indication of whether these required modules
91             are part of the standard Perl distribution, part of the module's distribution,
92             or must be installed separately.
93              
94             =head1 INCOMPATIBILITIES
95              
96             A list of any modules that this module cannot be used in conjunction with.
97             This may be due to name conflicts in the interface, or competition for system
98             or program resources, or due to internal limitations of Perl (for example, many
99             modules that use source code filters are mutually incompatible).
100              
101             =head1 BUGS AND LIMITATIONS
102              
103             A list of known problems with the module, together with some indication of
104             whether they are likely to be fixed in an upcoming release.
105              
106             Also, a list of restrictions on the features the module does provide: data types
107             that cannot be handled, performance issues and the circumstances in which they
108             may arise, practical limitations on the size of data sets, special cases that
109             are not (yet) handled, etc.
110              
111             The initial template usually just has:
112              
113             There are no known bugs in this module.
114              
115             Please report problems to Ivan Wills (ivan.wills@gamil.com).
116              
117             Patches are welcome.
118              
119             =head1 AUTHOR
120              
121             Ivan Wills - (ivan.wills@gamil.com)
122             <Author name(s)> (<contact address>)
123              
124             =head1 LICENSE AND COPYRIGHT
125              
126             Copyright (c) 2010 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW, Australia, 2077).
127             All rights reserved.
128              
129             This module is free software; you can redistribute it and/or modify it under
130             the same terms as Perl itself. See L<perlartistic>. This program is
131             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
132             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
133             PARTICULAR PURPOSE.
134              
135             =cut