Filename | /usr/local/lib/site_perl/Log/Filter/Module.pm |
Statements | Executed 23 statements in 463µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 12µs | 15µs | BEGIN@2 | Log::Filter::Module::
1 | 1 | 1 | 10µs | 35µs | BEGIN@105 | Log::Filter::Module::
1 | 1 | 1 | 7µs | 32µs | BEGIN@101 | Log::Filter::Module::
1 | 1 | 1 | 7µs | 39µs | BEGIN@73 | Log::Filter::Module::
1 | 1 | 1 | 7µs | 25µs | BEGIN@81 | Log::Filter::Module::
1 | 1 | 1 | 7µs | 33µs | BEGIN@99 | Log::Filter::Module::
1 | 1 | 1 | 6µs | 11µs | BEGIN@3 | Log::Filter::Module::
1 | 1 | 1 | 6µs | 35µs | BEGIN@98 | Log::Filter::Module::
1 | 1 | 1 | 6µs | 30µs | BEGIN@102 | Log::Filter::Module::
1 | 1 | 1 | 5µs | 29µs | BEGIN@104 | Log::Filter::Module::
1 | 1 | 1 | 3µs | 3µs | BEGIN@80 | Log::Filter::Module::
1 | 1 | 1 | 2µs | 2µs | END | Log::Filter::Module::
0 | 0 | 0 | 0s | 0s | _init | Log::Filter::Module::
0 | 0 | 0 | 0s | 0s | accept | Log::Filter::Module::
0 | 0 | 0 | 0s | 0s | new | Log::Filter::Module::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Log::Filter::Module; | ||||
2 | 2 | 22µs | 2 | 18µs | # spent 15µs (12+3) within Log::Filter::Module::BEGIN@2 which was called:
# once (12µs+3µs) by Log::Filter::All::BEGIN@71 at line 2 # spent 15µs making 1 call to Log::Filter::Module::BEGIN@2
# spent 3µs making 1 call to strict::import |
3 | 2 | 54µs | 2 | 16µs | # spent 11µs (6+5) within Log::Filter::Module::BEGIN@3 which was called:
# once (6µs+5µs) by Log::Filter::All::BEGIN@71 at line 3 # spent 11µs making 1 call to Log::Filter::Module::BEGIN@3
# spent 5µs making 1 call to warnings::import |
4 | |||||
5 | ################################################################################ | ||||
6 | # | ||||
7 | # DOCUMENTATION SECTION | ||||
8 | # | ||||
9 | ################################################################################ | ||||
10 | |||||
11 | =head1 NAME | ||||
12 | |||||
13 | Log::Filter::Module - Base module defining mandatory interface for all log filtering modules | ||||
14 | |||||
15 | =head1 SYNOPSIS | ||||
16 | |||||
17 | use Log::Filter::Module; | ||||
18 | |||||
19 | BEGIN { | ||||
20 | @ISA = ('Log::Filter::Module'); | ||||
21 | } | ||||
22 | |||||
23 | =head1 DESCRIPTION | ||||
24 | |||||
25 | Classes extending this base class may be used as FILTERS in loging framework. | ||||
26 | Filters are used in channels for restricting messages, that will be passed | ||||
27 | to the writers. | ||||
28 | |||||
29 | Filters are intended to be used in chains. Most important is the accept() | ||||
30 | method, which returns array containing the result of the filtering (message | ||||
31 | is ACCEPTed or REJECTed) and flag determining, if the evaluation should | ||||
32 | CONTINUE, or FINISH. The caller is responsible for appropriate reaction. | ||||
33 | |||||
34 | =head1 USAGE | ||||
35 | |||||
36 | =head1 BUGS | ||||
37 | |||||
38 | =head1 SUPPORT | ||||
39 | |||||
40 | =head1 AUTHOR | ||||
41 | |||||
42 | Jan Mach | ||||
43 | Cesnet, z.s.p.o | ||||
44 | jan.mach@cesnet.cz | ||||
45 | http://www.cesnet.cz | ||||
46 | |||||
47 | =head1 COPYRIGHT | ||||
48 | |||||
49 | This program is free software; you can redistribute | ||||
50 | it and/or modify it under the same terms as Perl itself. | ||||
51 | |||||
52 | The full text of the license can be found in the | ||||
53 | LICENSE file included with this module. | ||||
54 | |||||
55 | |||||
56 | =head1 SEE ALSO | ||||
57 | |||||
58 | perl(1). | ||||
59 | |||||
60 | =head1 FUNCTION REFERENCE | ||||
61 | |||||
62 | =over 4 | ||||
63 | |||||
64 | =cut | ||||
65 | |||||
66 | ################################################################################ | ||||
67 | # | ||||
68 | # INITIALIZATION AND CLEANUP SECTION | ||||
69 | # | ||||
70 | ################################################################################ | ||||
71 | |||||
72 | #-- Perl core modules ---------------------------------------------------------# | ||||
73 | 2 | 41µs | 2 | 71µs | # spent 39µs (7+32) within Log::Filter::Module::BEGIN@73 which was called:
# once (7µs+32µs) by Log::Filter::All::BEGIN@71 at line 73 # spent 39µs making 1 call to Log::Filter::Module::BEGIN@73
# spent 32µs making 1 call to Exporter::import |
74 | |||||
75 | #-- Perl CPAN modules ---------------------------------------------------------# | ||||
76 | |||||
77 | #-- Custom application modules ------------------------------------------------# | ||||
78 | |||||
79 | #-- Module initializations ----------------------------------------------------# | ||||
80 | # spent 3µs within Log::Filter::Module::BEGIN@80 which was called:
# once (3µs+0s) by Log::Filter::All::BEGIN@71 at line 83 | ||||
81 | 2 | 24µs | 2 | 42µs | # spent 25µs (7+18) within Log::Filter::Module::BEGIN@81 which was called:
# once (7µs+18µs) by Log::Filter::All::BEGIN@71 at line 81 # spent 25µs making 1 call to Log::Filter::Module::BEGIN@81
# spent 18µs making 1 call to vars::import |
82 | 1 | 3µs | $VERSION = '0.01'; | ||
83 | 1 | 33µs | 1 | 3µs | } # spent 3µs making 1 call to Log::Filter::Module::BEGIN@80 |
84 | |||||
85 | |||||
86 | #-- Module clean-up code (global destructor) ----------------------------------# | ||||
87 | 1 | 2µs | # spent 2µs within Log::Filter::Module::END which was called:
# once (2µs+0s) by main::RUNTIME at line 0 of mentat.storage.mongo.pl | ||
88 | |||||
89 | } | ||||
90 | |||||
91 | ################################################################################ | ||||
92 | # | ||||
93 | # CONSTANTS AND GLOBAL VARIABLES DEFINITION SECTION | ||||
94 | # | ||||
95 | ################################################################################ | ||||
96 | |||||
97 | #-- Constants -----------------------------------------------------------------# | ||||
98 | 2 | 28µs | 2 | 63µs | # spent 35µs (6+28) within Log::Filter::Module::BEGIN@98 which was called:
# once (6µs+28µs) by Log::Filter::All::BEGIN@71 at line 98 # spent 35µs making 1 call to Log::Filter::Module::BEGIN@98
# spent 28µs making 1 call to constant::import |
99 | 2 | 25µs | 2 | 59µs | # spent 33µs (7+26) within Log::Filter::Module::BEGIN@99 which was called:
# once (7µs+26µs) by Log::Filter::All::BEGIN@71 at line 99 # spent 33µs making 1 call to Log::Filter::Module::BEGIN@99
# spent 26µs making 1 call to constant::import |
100 | |||||
101 | 2 | 23µs | 2 | 58µs | # spent 32µs (7+25) within Log::Filter::Module::BEGIN@101 which was called:
# once (7µs+25µs) by Log::Filter::All::BEGIN@71 at line 101 # spent 32µs making 1 call to Log::Filter::Module::BEGIN@101
# spent 25µs making 1 call to constant::import |
102 | 2 | 22µs | 2 | 54µs | # spent 30µs (6+24) within Log::Filter::Module::BEGIN@102 which was called:
# once (6µs+24µs) by Log::Filter::All::BEGIN@71 at line 102 # spent 30µs making 1 call to Log::Filter::Module::BEGIN@102
# spent 24µs making 1 call to constant::import |
103 | |||||
104 | 2 | 25µs | 2 | 53µs | # spent 29µs (5+24) within Log::Filter::Module::BEGIN@104 which was called:
# once (5µs+24µs) by Log::Filter::All::BEGIN@71 at line 104 # spent 29µs making 1 call to Log::Filter::Module::BEGIN@104
# spent 24µs making 1 call to constant::import |
105 | 2 | 158µs | 2 | 59µs | # spent 35µs (10+25) within Log::Filter::Module::BEGIN@105 which was called:
# once (10µs+25µs) by Log::Filter::All::BEGIN@71 at line 105 # spent 35µs making 1 call to Log::Filter::Module::BEGIN@105
# spent 25µs making 1 call to constant::import |
106 | |||||
107 | #-- Static public class variables (our) ---------------------------------------# | ||||
108 | |||||
109 | #-- Static protected class variables (my) -------------------------------------# | ||||
110 | |||||
111 | ################################################################################ | ||||
112 | # | ||||
113 | # IMPLEMENTATION SECTION | ||||
114 | # | ||||
115 | ################################################################################ | ||||
116 | |||||
117 | =item new() [PUBLIC,STATIC] | ||||
118 | |||||
119 | Usage : my $filter = Log::Filter::(module)->new(... arguments); | ||||
120 | Purpose : Create new instance of log filter | ||||
121 | Returns : Reference to the new instance | ||||
122 | Arguments : All arguments are passed to the _init() method | ||||
123 | Throws : Croaks, if invoked on object | ||||
124 | Comments : This method should not be overloaded, descendants should implement their version of _init() method instead | ||||
125 | See Also : _init() method | ||||
126 | |||||
127 | =cut | ||||
128 | |||||
129 | sub new | ||||
130 | { | ||||
131 | my $class = shift; | ||||
132 | croak ((caller(0))[3] . ": class method invoked on object") if ref $class; | ||||
133 | my $self = bless ({}, $class); | ||||
134 | return $self->_init(@_); | ||||
135 | } | ||||
136 | |||||
137 | =item accept($$$) [ABSTRACT,PUBLIC] | ||||
138 | |||||
139 | Usage : my ($result, $continue) = $filter->accept($source, $severity, $message); | ||||
140 | Purpose : Check, if the filter will accept the given message | ||||
141 | Returns : Array (ACCEPT|REJECT,CONTINUE|FINISH) | ||||
142 | Arguments : string $source - Name of the source of the message | ||||
143 | enum $severity - Severity in integer or string format (see Log::Core::Essentials for permited values) | ||||
144 | string $message - Message | ||||
145 | Throws : Croaks, if not implemented in descendant classes | ||||
146 | Comments : ABSTRACT method, must be implemented in descendant classes | ||||
147 | See Also : | ||||
148 | |||||
149 | =cut | ||||
150 | |||||
151 | sub accept($$$) { | ||||
152 | my $self = shift; | ||||
153 | croak ((caller(0))[3] . ": method needs implementation"); | ||||
154 | } | ||||
155 | |||||
156 | =item _init() [ABSTRACT,PROTECTED] | ||||
157 | |||||
158 | Usage : Used from constructor as follows: return $self->_init(@_); | ||||
159 | Purpose : Initialize newly created filter instance | ||||
160 | Returns : Must return $self | ||||
161 | Arguments : Unknown, depend on the implementation | ||||
162 | Throws : Croaks, if not implemented in descendant classes | ||||
163 | Comments : ABSTRACT method, must be implemented in descendant classes | ||||
164 | See Also : new() method | ||||
165 | |||||
166 | =cut | ||||
167 | |||||
168 | sub _init { | ||||
169 | my $self = shift; | ||||
170 | croak ((caller(0))[3] . ": method needs implementation"); | ||||
171 | } | ||||
172 | |||||
173 | =pod | ||||
174 | |||||
175 | =back | ||||
176 | |||||
177 | =cut | ||||
178 | |||||
179 | 1 | 2µs | 1; |