| 1 | # This code is part of Perl distribution Mail-Box version 4.02. | ||||||||||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||||||||||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | package Mail::Box::Message::Destructed;{ | ||||||||||||||||||||||||||||
| 13 | 34 | our $VERSION = '4.02'; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 34 | ▶ | use parent 'Mail::Box::Message'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 34 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 34 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 34 | ▶ | use Log::Report 'mail-box', import => [ qw/__x error/ ]; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #-------------------- | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub new(@) { error __x"you cannot instantiate a destructed message." } | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | sub isDummy() { 1 } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub head(;$) | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | { my ($self, $head) = @_; | ||||||||||||||||||||||||||
|
Subroutine
head: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | @_==1 and error __x"you cannot take the head of a destructed message."; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | defined $head and error __x"you cannot set the head on a destructed message."; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | undef; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub body(;$) | ||||||||||||||||||||||||||||
| 39 | 0 | ▶ | { my ($self, $body) = @_; | ||||||||||||||||||||||||||
|
Subroutine
body: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | @_==1 and error __x"you cannot take the body of a destructed message."; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | defined $body and error __x"you cannot set the body on a destructed message."; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 0 | undef; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | sub coerce($) | ||||||||||||||||||||||||||||
| 47 | 55 | ▶ | { my ($class, $message) = @_; | ||||||||||||||||||||||||||
|
Subroutine
coerce: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 55 | ▶ | $message->isa('Mail::Box::Message') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | or error __x"you cannot coerce a {class} into destruction.", class => ref $message; | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 55 | $message->body(undef); | |||||||||||||||||||||||||||
| 53 | 55 | $message->head(undef); | |||||||||||||||||||||||||||
| 54 | 55 | $message->modified(0); | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 55 | bless $message, $class; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub modified(;$) | ||||||||||||||||||||||||||||
| 61 | 1 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
modified: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | ▶ | ! @_ || ! $_[0] | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and $_[0]
MC/DC0%0/2
@_ and $_[0]
@_
$_[0]
Truth table33%1/3
A and B
A= @_B= $_[0]
| |||||||||||||||||||||||||||||
| 64 | or error __x"you cannot set the modified flag on a destructed message."; | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1 | 0; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub isModified() { 0 } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | sub label($;@) | ||||||||||||||||||||||||||||
| 73 | 3 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
label: called CC=6 SCAR=19.4
Pod
documented
| |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 3 | ▶ | if(@_==1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 2 | { my $label = shift; | |||||||||||||||||||||||||||
| 77 | 2 | ▶ | return $self->SUPER::label('deleted') if $label eq 'deleted'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | error __x"destructed message has no labels except 'deleted', requested is {label}.", label => $label; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 1 | my %flags = @_; | |||||||||||||||||||||||||||
| 83 | keys %flags==1 && exists $flags{deleted} | ||||||||||||||||||||||||||||
| 84 | 1 | ▶ | or error __x"destructed message has no labels except 'deleted', trying to set {labels}.", labels => [keys %flags]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
keys %flags == 1 and exists $flags{"deleted"}
MC/DC0%0/2
keys %flags == 1 and exists $flags{"deleted"}
keys %flags == 1
exists $flags{"deleted"}
Truth table33%1/3
A and B
A= keys %flags == 1B= exists $flags{"deleted"}
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | $flags{deleted} | ||||||||||||||||||||||||||||
| 87 | 1 | ▶ | or error __x"destructed message can not be undeleted."; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | 1; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub labels() { wantarray ? ('deleted') : +{deleted => 1} } | ||||||||||||||||||||||||||
|
Subroutine
labels: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 34 | 1; | |||||||||||||||||||||||||||