blib/lib/Siesta/Plugin/Resume.pm

filter: Statementstmt 63.6% 14 / 22 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 50.0% 1 / 2 totaltotal 56.7% 21 / 37 CC 5 SCAR 23.1
CC
5
Cov
50%
process
17.3
BEGIN
1.0
BEGIN
1.0
CRAP 10.1
« lib/Siesta/Build.pm ↑ Summary blib/lib/Siesta/Plugin.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Siesta::Plugin::Resume;
3 3 ▶use base 'Siesta::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Digest::MD5 qw(md5_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶sub description { "set a deferred message on its way" }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
6  
7 1 ▶sub process {
Subroutine process: called CC=5 SCAR=28.5
Pod documented
8 1 my $self = shift;
9 1 my $mail = shift;
10  
11 1 ▶ return unless $mail->body =~ /resume (\d+) (\S+)/;
Branch: 1 branch
BranchTrueFalseTotal
unless $mail->body =~ /resume (\d+) (\S+)/ 1 0 1
12 0 my ($id, $hash) = ($1, $2);
13  
14 0 ▶ my $deferred = Siesta::Deferred->retrieve( $id ) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $deferred = "Siesta::Deferred"->retrieve($id) or return 0 0 0
15 0 ▶ unless ($deferred->who->email eq $mail->from) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($deferred->who->email eq $mail->from) 0 0 0
16 # you don't own this message, so you can't resume it
17 0 return 1;
18 }
19 0 ▶ unless ( $deferred->hash eq $hash ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($deferred->hash eq $hash) 0 0 0
20 # wrong magic cookie
21 0 return 1;
22 }
23 0 $deferred->resume;
24 0 return 1;
25 }
26  
27 3 1;
« lib/Siesta/Build.pm ↑ Summary blib/lib/Siesta/Plugin.pm »