lib/Mail/Decency/ContentFilter/Razor.pm

filter: Statementstmt 68.0% 17 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 1 / 1 totaltotal 64.7% 22 / 34 CC 2 SCAR 9.4
CC
2
Cov
63%
handle_filter_result
6.0
init
2.0
BEGIN
1.0
CRAP 2.6
« lib/Mail/Decency/Helper/IP.pm ↑ Summary lib/Mail/Decency/Core/Child.pm »
1 package Mail::Decency::ContentFilter::Razor;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends qw/
5 Mail::Decency::ContentFilter::Core
6 /;
7 1 with qw/
8 Mail::Decency::ContentFilter::Core::Cmd
9 Mail::Decency::ContentFilter::Core::User
10 Mail::Decency::ContentFilter::Core::Spam
11 /;
12  
13 1 ▶use version 0.74; our $VERSION = qv( "v0.1.6" );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 =head1 NAME
19  
20 Mail::Decency::ContentFilter::Razor
21  
22 =head1 DESCRIPTION
23  
24 Checks mails against the razor network.
25  
26 =head2 CONFIG
27  
28 ---
29
30 disable: 0
31 #max_size: 0
32 #timeout: 30
33
34 #cmd_check: '/usr/bin/razor-check %file%'
35
36 # weight for known innocent (good) mails
37 weight_innocent: 10
38
39 # weight for known spam (bad) mails
40 weight_spam: -100
41
42  
43  
44 =head1 CLASS ATTRIBUTES
45  
46 =cut
47  
48 1 has cmd_check => (
49 is => 'rw',
50 isa => 'Str',
51 default => '/usr/bin/razor-check %file%'
52 );
53  
54 # has cmd_learn_spam => (
55 # is => 'rw',
56 # isa => 'Str',
57 # default => '/usr/bin/razor-report %file%'
58 # );
59  
60 # has cmd_unlearn_spam => (
61 # is => 'rw',
62 # isa => 'Str',
63 # default => '/usr/bin/razor-revoke %file%'
64 # );
65  
66  
67 =head1 METHODS
68  
69 =head2 init
70  
71 =cut
72  
73 0 ▶sub init {
Subroutine init: not called CC=1 SCAR=6.9
74 0 my ( $self ) = @_;
75
76 0 $self->next::method();
77
78 0 $self->config->{ disable_train } = 1;
79 }
80  
81  
82 =head2 handle_filter_result
83  
84 =cut
85  
86 0 ▶sub handle_filter_result {
Subroutine handle_filter_result: not called CC=2 SCAR=17.9
Pod documented
87 0 my ( $self, $result, $exit_code ) = @_;
88
89 # it is ham
90 0 ▶ if ( $exit_code > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exit_code > 0) { } 0 0 0
91 0 return $self->add_spam_score( $self->weight_innocent => [
92 'Razor: This is HAM'
93 ] );
94 }
95
96 # it is spam
97 else {
98 0 return $self->add_spam_score( $self->weight_spam => [
99 'Razor: This is SPAM'
100 ] );
101 }
102
103 0 return ;
104 }
105  
106  
107 =head1 AUTHOR
108  
109 Ulrich Kautz <uk@fortrabbit.de>
110  
111 =head1 COPYRIGHT
112  
113 Copyright (c) 2010 the L</AUTHOR> as listed above
114  
115 =head1 LICENCSE
116  
117 This library is free software and may be distributed under the same terms as perl itself.
118  
119 =cut
120  
121 1 1;
« lib/Mail/Decency/Helper/IP.pm ↑ Summary lib/Mail/Decency/Core/Child.pm »