Mail/Abuse/Processor.pm

filter: Statementstmt 97.0% 33 / 34 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 50.0% 1 / 2 totaltotal 85.1% 46 / 54 CC 4 SCAR 6.1
CC
4
Cov
90%
new
3.3
process
2.0
__ANON__
2.0
CRAP 1.8
« Mail/Abuse/Filter.pm ↑ Summary Mail/Abuse.pm »
1 package Mail::Abuse::Processor;
2  
3 11 require 5.005_62;
4  
5 11 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # The code below should be in a single line
10  
11 11 our $VERSION = do { my @r = (q$Revision: 1.5 $ =~ /\d+/g); sprintf " %d."."%03d" x $#r, @r };
12  
13 =pod
14  
15 =head1 NAME
16  
17 Mail::Abuse::Processor - Process a Mail::Abuse::Report
18  
19 =head1 SYNOPSIS
20  
21 package Mail::Abuse::Processor::MyProcessor;
22 use Mail::Abuse::Processor;
23  
24 use base 'Mail::Abuse::Processor';
25 sub process { ... }
26 package main;
27  
28 use Mail::Abuse::Report;
29 my $p = new Mail::Abuse::Processor::MyProcessor;
30 my $report = new Mail::Abuse::Report (processors => [ $p ]);
31  
32 # ... other pieces of code that configure the report ...
33  
34 =head1 DESCRIPTION
35  
36 This class implements the actions that are performed in a
37 C<Mail::Abuse::Report> after it has been received and parsed. Actions
38 usually include storing the report, opening tickets, etc.
39  
40 The following functions are provided for the customization of the
41 behavior of the class.
42  
43 =cut
44  
45 sub new
46 31 ▶{
Subroutine new: called CC=3 SCAR=12.0
Pod undocumented
47 31 my $type = shift;
48 31 ▶ my $class = ref($type) || $type;
Condition33%1/3
ref $type || $type
l!l&&r!l&&!r
0310
MC/DC0%0/2
ref $type || $type
ref $type $type
Truth table33%1/3
A || B
A= ref $typeB= $type
ABresult
1X1
011
000
49  
50 31 ▶ croak "Invalid call to Mail::Abuse::Processor::new"
Branch: 1 branch
BranchTrueFalseTotal
unless $class 0 31 31
51 unless $class;
52  
53 31 bless {}, $class;
54 }
55  
56 =pod
57  
58 =over
59  
60 =item C<process($report)>
61  
62 Takes a C<Mail::Abuse::Report> object as an argument and performs the
63 processing action required.
64  
65 =cut
66  
67 sub process
68 0 ▶{
Subroutine process: not called CC=1 SCAR=6.9
Pod documented
69 0 croak "Mail::Abuse::Processor is a virtual class";
70 }
71  
72 sub AUTOLOAD
73 11 ▶{
Subroutine AUTOLOAD: called CC=1 SCAR=0.0
74 11 ▶ no strict "refs";
Subroutine BEGIN: called CC=1 SCAR=0.0
75 11 ▶ use vars qw($AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
76 11 my $method = $AUTOLOAD;
77 11 $method =~ s/^.*:://;
78 *$method = sub
79 91 ▶ {
Subroutine __ANON__: called CC=2 SCAR=6.9
80 91 my $self = shift;
81 91 my $ret = $self->{$method};
82 91 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 20 71 91
83 {
84 20 $ret = $self->{$method};
85 20 $self->{$method} = shift;
86 }
87 91 return $ret;
88 11 };
89 11 goto \&$method;
90 }
91  
92 __END__
« Mail/Abuse/Filter.pm ↑ Summary Mail/Abuse.pm »