blib/lib/Siesta/Plugin/Bounce.pm

filter: Statementstmt 93.1% 27 / 29 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 89.7% 35 / 39 CC 2 SCAR 2.6
CC
2
Cov
90%
process
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« blib/lib/Siesta/Plugin/Challenge.pm ↑ Summary blib/lib/Siesta/Plugin/ReplyTo.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Siesta::Plugin::Bounce;
3 3 ▶use Siesta::Plugin;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use base 'Siesta::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Mail::DeliveryStatus::BounceParser;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # suggested usage set_plugins( bounce => qw( Bounce ) );
8  
9 1 ▶sub description {
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
10 1 'simple bounce handler';
11 }
12  
13 1 ▶sub process {
Subroutine process: called CC=2 SCAR=7.0
Pod documented
14 1 my $self = shift;
15 1 my $mail = shift;
16 1 my $list = $self->list;
17  
18 1 my $deferred = $mail->defer(who => $list->owner,
19 why => "bounce");
20  
21 1 my $bounce = Mail::DeliveryStatus::BounceParser->new( $mail->as_string );
22 1 my @addresses = grep { $_ } map { $_->get('email') } $bounce->reports;
23  
24 1 Siesta->log("bounce: ". $list->name . " " . join (', ', @addresses));
25  
26 1 ▶ if (grep { $_ eq $list->owner->email } @addresses) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq $list->owner->email;} @addresses) 0 1 1
27 # deep deep badness
28 0 Siesta->log("holy shit, a listadmins mail is bouncing, so we can't tell them about it!");
29 0 return;
30 }
31 1 $mail->reply( to => $list->owner->email,
32 subject => $list->name . " bouncing subscriber(s)",
33 body => join("\n", @addresses) );
34 1 return;
35 }
36  
37 3 1;
« blib/lib/Siesta/Plugin/Challenge.pm ↑ Summary blib/lib/Siesta/Plugin/ReplyTo.pm »