MtPolicyd/Result.pm

filter: Statementstmt 86.9% 20 / 23 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 3 totaltotal 75.0% 27 / 36 CC 3 SCAR 5.0
CC
3
Cov
81%
as_policyd_response
2.1
actions
2.0
as_log
2.0
CRAP 1.7
« MtPolicyd/Connection/Memcached.pm ↑ Summary MtPolicyd/Plugin.pm »
1 package Mail::MtPolicyd::Result;
2  
3 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 our $VERSION = '2.01'; # VERSION
7 # ABSTRACT: class to hold the results of a request returned by plugins
8  
9 has 'plugin_results' => (
10 is => 'ro',
11 isa => 'ArrayRef[Mail::MtPolicyd::Plugin::Result]',
12 lazy => 1,
13 2 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
14 6 traits => [ 'Array' ],
15 handles => {
16 'add_plugin_result' => 'push',
17 },
18 );
19  
20 6 has 'last_match' => ( is => 'rw', isa => 'Maybe[Str]' );
21  
22 sub actions {
23 1 ▶ my $self = shift;
Subroutine actions: called CC=2 SCAR=7.0
Pod undocumented
24 return map {
25 1 ▶ defined $_->action ? $_->action : ()
Branch: 1 branch
BranchTrueFalseTotal
defined $_->action ? : 1 0 1
26 1 } @{$self->plugin_results};
27 }
28  
29 sub as_log {
30 0 ▶ my $self = shift;
Subroutine as_log: not called CC=1 SCAR=6.9
Pod undocumented
31 0 return join(',', $self->actions);
32 }
33  
34 sub as_policyd_response {
35 1 ▶ my $self = shift;
Subroutine as_policyd_response: called CC=2 SCAR=7.4
Pod undocumented
36 1 my @actions = $self->actions;
37 1 ▶ if( ! @actions ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@actions) 0 1 1
38 # we have nothing to say
39 0 return("action=dunno\n\n");
40 }
41 1 return('action='.join("\naction=", @actions)."\n\n");
42 }
43  
44 6 __PACKAGE__->meta->make_immutable;
45  
46 6 1;
47  
48 __END__
49  
50 =pod
51  
52 =encoding UTF-8
53  
54 =head1 NAME
55  
56 Mail::MtPolicyd::Result - class to hold the results of a request returned by plugins
57  
58 =head1 VERSION
59  
60 version 2.01
61  
62 =head1 AUTHOR
63  
64 Markus Benning <ich@markusbenning.de>
65  
66 =head1 COPYRIGHT AND LICENSE
67  
68 This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
69  
70 This is free software, licensed under:
71  
72 The GNU General Public License, Version 2, June 1991
73  
74 =cut
« MtPolicyd/Connection/Memcached.pm ↑ Summary MtPolicyd/Plugin.pm »