| 1 | package Mail::MtPolicyd::Plugin::Eval; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | our $VERSION = '1.12'; # VERSION | |||||||||
| 7 | # ABSTRACT: mtpolicyd plugin to capture the output of plugins | ||||||||||
| 8 | |||||||||||
| 9 | |||||||||||
| 10 | 1 | extends 'Mail::MtPolicyd::Plugin'; | |||||||||
| 11 | 1 | with 'Mail::MtPolicyd::Plugin::Role::PluginChain'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has 'store_in' => ( is => 'ro', isa => 'Str', required => 1 ); | |||||||||
| 14 | |||||||||||
| 15 | sub run { | ||||||||||
| 16 | 0 | ▶ | my ( $self, $r ) = @_; | ||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 17 | 0 | my $field = $self->store_in; | |||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | if( ! defined $self->chain ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | return; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 0 | my $chain_result = $self->chain->run( $r ); | |||||||||
| 24 | 0 | my @actions = $chain_result->actions; | |||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | if( scalar @actions ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | $r->session->{$field} = join("\n", @actions) | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | return; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 34 | |||||||||||
| 35 | 1 | 1; | |||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | __END__ | ||||||||||
| 39 | =pod | ||||||||||
| 40 | |||||||||||
| 41 | =head1 NAME | ||||||||||
| 42 | |||||||||||
| 43 | Mail::MtPolicyd::Plugin::Eval - mtpolicyd plugin to capture the output of plugins | ||||||||||
| 44 | |||||||||||
| 45 | =head1 VERSION | ||||||||||
| 46 | |||||||||||
| 47 | version 1.12 | ||||||||||
| 48 | |||||||||||
| 49 | =head1 DESCRIPTION | ||||||||||
| 50 | |||||||||||
| 51 | This plugin executes a list of configured plugins but will not return the | ||||||||||
| 52 | action back to mtpolicyd. Instead it writes the output of the plugins to a | ||||||||||
| 53 | variable within the session. | ||||||||||
| 54 | |||||||||||
| 55 | =head1 PARAMETERS | ||||||||||
| 56 | |||||||||||
| 57 | =over | ||||||||||
| 58 | |||||||||||
| 59 | =item store_in (required) | ||||||||||
| 60 | |||||||||||
| 61 | The name of the key in the session to store the result of the eval'ed checks. | ||||||||||
| 62 | |||||||||||
| 63 | =item Plugin (required) | ||||||||||
| 64 | |||||||||||
| 65 | A list of checks to execute. | ||||||||||
| 66 | |||||||||||
| 67 | =back | ||||||||||
| 68 | |||||||||||
| 69 | =head1 EXAMPLE | ||||||||||
| 70 | |||||||||||
| 71 | <Plugin eval-spf> | ||||||||||
| 72 | module = "Eval" | ||||||||||
| 73 | # store result in spf_action | ||||||||||
| 74 | store_in="spf_action" | ||||||||||
| 75 | <Plugin proxy-spf> | ||||||||||
| 76 | module = "Proxy" | ||||||||||
| 77 | host = "localhost:10023" | ||||||||||
| 78 | </Plugin> | ||||||||||
| 79 | </Plugin> | ||||||||||
| 80 | |||||||||||
| 81 | =head1 AUTHOR | ||||||||||
| 82 | |||||||||||
| 83 | Markus Benning <ich@markusbenning.de> | ||||||||||
| 84 | |||||||||||
| 85 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 86 | |||||||||||
| 87 | This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>. | ||||||||||
| 88 | |||||||||||
| 89 | This is free software, licensed under: | ||||||||||
| 90 | |||||||||||
| 91 | The GNU General Public License, Version 2, June 1991 | ||||||||||
| 92 | |||||||||||
| 93 | =cut | ||||||||||
| 94 | |||||||||||