| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Mail::MtPolicyd::Result; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 6 |  |  | 6 |  | 24 | use Moose; | 
|  | 6 |  |  |  |  | 7 |  | 
|  | 6 |  |  |  |  | 36 |  | 
| 4 | 6 |  |  | 6 |  | 25804 | use namespace::autoclean; | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 47 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = '2.02'; # 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 |  |  |  |  |  |  | default => sub { [] }, | 
| 14 |  |  |  |  |  |  | traits => [ 'Array' ], | 
| 15 |  |  |  |  |  |  | handles => { | 
| 16 |  |  |  |  |  |  | 'add_plugin_result' => 'push', | 
| 17 |  |  |  |  |  |  | }, | 
| 18 |  |  |  |  |  |  | ); | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | has 'last_match' => ( is => 'rw', isa => 'Maybe[Str]' ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub actions { | 
| 23 | 1 |  |  | 1 | 0 | 2 | my $self = shift; | 
| 24 |  |  |  |  |  |  | return map { | 
| 25 | 1 | 50 |  |  |  | 27 | defined $_->action ? $_->action : () | 
| 26 | 1 |  |  |  |  | 1 | } @{$self->plugin_results}; | 
|  | 1 |  |  |  |  | 32 |  | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub as_log { | 
| 30 | 0 |  |  | 0 | 0 | 0 | my $self = shift; | 
| 31 | 0 |  |  |  |  | 0 | return join(',', $self->actions); | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub as_policyd_response { | 
| 35 | 1 |  |  | 1 | 0 | 401 | my $self = shift; | 
| 36 | 1 |  |  |  |  | 3 | my @actions = $self->actions; | 
| 37 | 1 | 50 |  |  |  | 2 | if( ! @actions ) { | 
| 38 |  |  |  |  |  |  | # we have nothing to say | 
| 39 | 0 |  |  |  |  | 0 | return("action=dunno\n\n"); | 
| 40 |  |  |  |  |  |  | } | 
| 41 | 1 |  |  |  |  | 6 | return('action='.join("\naction=", @actions)."\n\n"); | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | 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.02 | 
| 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 |