line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Saftpresse::Plugin; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2225
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: base class for saftpresse plugins |
6
|
|
|
|
|
|
|
our $VERSION = '1.6'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5723
|
use Log::Saftpresse::Counters; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
237
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'name' => ( is => 'ro', isa => 'Str', required => 1 ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'counters' => ( |
14
|
|
|
|
|
|
|
is => 'ro', isa => 'Log::Saftpresse::Counters', lazy => 1, |
15
|
|
|
|
|
|
|
default => sub { |
16
|
|
|
|
|
|
|
Log::Saftpresse::Counters->new; |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
handles => [ 'incr', 'incr_one', 'incr_max' ], |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub process { |
23
|
0
|
|
|
0
|
1
|
|
my ( $self, $stash, $notes ) = @_; |
24
|
0
|
|
|
|
|
|
die('not implemented'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
1
|
|
sub init { return; } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=pod |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding UTF-8 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Log::Saftpresse::Plugin - base class for saftpresse plugins |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 VERSION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
version 1.6 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 Description |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This is the base class for saftpresse processing plugins. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
All plugin classes must inherit from this class. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 Synopsis |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
package Log::Saftpresse::Plugin::MyPlugin; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use Moose; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
extends 'Log::Saftpresse::Plugin'; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub process { |
60
|
|
|
|
|
|
|
my ( $self, $event ) = @_; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$event->{'example_text'} = 'this is an example'; |
63
|
|
|
|
|
|
|
$self->incr_one('examples', 'count'); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 Attributes |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 name( $str ) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
The name of plugin instance. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 counters( L<Log::Saftpresse::Counters> ) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Holds the counters of this plugin. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 Methods |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 process( $event, $notes ) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This method must be implemented by every plugin. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Saftpresse will call it for every processed event and |
87
|
|
|
|
|
|
|
pass $event and $notes. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 init |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This method is called after an instance of the plugin has been created. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
A module could implement it to do initialization tasks. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 incr, incr_one, incr_max |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This methods are delegated to the counter object. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software, licensed under: |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |