Box/Message/Destructed.pm

filter: Statementstmt 32.0% 17 / 53 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 41.6% 5 / 12 Podpod 100% 7 / 7 totaltotal 26.3% 29 / 110 CC 14 SCAR 27.5
CC
14
Cov
20%
label
42.0
head
12.0
body
12.0
CRAP 15.6
« Box/Test.pm ↑ Summary Box/Locker/Multi.pm »
1 # Copyrights 2001-2020 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of distribution Mail-Box. Meta-POD processed with
6 # OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package Mail::Box::Message::Destructed;
10 1 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $VERSION = '3.009';
12  
13 1 ▶use base 'Mail::Box::Message';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20  
21 sub new(@)
22 0 ▶{ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
23 0 $class->log(ERROR => 'You cannot instantiate a destructed message');
24 0 undef;
25 }
26
27 sub isDummy() { 1 }
28  
29  
30 sub head(;$)
31 0 ▶{ my $self = shift;
Subroutine head: not called CC=3 SCAR=24.8
Pod documented
32 0 ▶ return undef if @_ && !defined(shift);
Branch: 1 branch
BranchTrueFalseTotal
if @_ and not defined shift() 0 0 0
Condition0%0/3
@_ and not defined shift()
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and not defined shift()
@_ not defined shift()
Truth table0%0/3
A and not(B)
A= @_B= not defined shift()
ABresult
0X0
100
111
33  
34 0 $self->log(ERROR => "You cannot take the head of a destructed message");
35 0 undef;
36 }
37  
38  
39 sub body(;$)
40 0 ▶{ my $self = shift;
Subroutine body: not called CC=3 SCAR=24.8
Pod documented
41 0 ▶ return undef if @_ && !defined(shift);
Branch: 1 branch
BranchTrueFalseTotal
if @_ and not defined shift() 0 0 0
Condition0%0/3
@_ and not defined shift()
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and not defined shift()
@_ not defined shift()
Truth table0%0/3
A and not(B)
A= @_B= not defined shift()
ABresult
0X0
100
111
42  
43 0 $self->log(ERROR => "You cannot take the body of a destructed message");
44 0 undef;
45 }
46  
47  
48 sub coerce($)
49 0 ▶{ my ($class, $message) = @_;
Subroutine coerce: not called CC=2 SCAR=17.9
Pod documented
50  
51 0 ▶ unless($message->isa('Mail::Box::Message'))
Branch: 1 branch
BranchTrueFalseTotal
unless ($message->isa("Mail::Box::Message")) 0 0 0
52 0 { $class->log(ERROR=>"Cannot coerce a ",ref($message), " into destruction");
53 0 return ();
54 }
55  
56 0 $message->body(undef);
57 0 $message->head(undef);
58 0 $message->modified(0);
59  
60 0 bless $message, $class;
61 }
62  
63 sub modified(;$)
64 0 ▶{ my $self = shift;
Subroutine modified: not called CC=3 SCAR=24.8
Pod documented
65  
66 0 ▶ $self->log(ERROR => 'Do not set the modified flag on a destructed message')
Branch: 1 branch
BranchTrueFalseTotal
if @_ and $_[0] 0 0 0
Condition0%0/3
@_ and $_[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and $_[0]
@_ $_[0]
Truth table0%0/3
A and B
A= @_B= $_[0]
ABresult
0X0
100
111
67 if @_ && $_[0];
68  
69 0 0;
70 }
71  
72 sub isModified() { 0 }
73  
74  
75 sub label($;@)
76 0 ▶{ my $self = shift;
Subroutine label: not called CC=6 SCAR=37.4
Pod documented
77  
78 0 ▶ if(@_==1)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) 0 0 0
79 0 { my $label = shift;
80 0 ▶ return $self->SUPER::label('deleted') if $label eq 'deleted';
Branch: 1 branch
BranchTrueFalseTotal
if $label eq "deleted" 0 0 0
81 0 $self->log(ERROR => "Destructed message has no labels except 'deleted', requested is $label");
82 0 return 0;
83 }
84  
85 0 my %flags = @_;
86 0 ▶ unless(keys %flags==1 && exists $flags{deleted})
Branch: 1 branch
BranchTrueFalseTotal
unless (keys %flags == 1 and exists $flags{"deleted"}) 0 0 0
Condition0%0/3
keys %flags == 1 and exists $flags{"deleted"}
!ll&&!rl&&r
000
MC/DC0%0/2
keys %flags == 1 and exists $flags{"deleted"}
keys %flags == 1 exists $flags{"deleted"}
Truth table0%0/3
A and B
A= keys %flags == 1B= exists $flags{"deleted"}
ABresult
0X0
100
111
87 0 { $self->log(ERROR => "Destructed message has no labels except 'deleted', trying to set @{[ keys %flags ]}");
88 0 return;
89 }
90  
91 $self->log(ERROR => "Destructed messages can not be undeleted")
92 0 ▶ unless $flags{deleted};
Branch: 1 branch
BranchTrueFalseTotal
unless $flags{"deleted"} 0 0 0
93  
94 0 1;
95 }
96  
97 0 ▶sub labels() { wantarray ? ('deleted') : +{deleted => 1} }
Subroutine labels: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
98  
99 1 1;
« Box/Test.pm ↑ Summary Box/Locker/Multi.pm »