MtPolicyd/Result.pm

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