Box/POP3/Message.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 79 SCAR 45.0
CC
9
Cov
0%
label
30.0
loadBody
12.0
size
6.0
CRAP 90.0
1 # Copyrights 2001-2019 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-POP3. 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::POP3::Message;
10 use vars '$VERSION';
11 $VERSION = '3.005';
12  
13 use base 'Mail::Box::Net::Message';
14  
15 use strict;
16 use warnings;
17  
18  
19 sub init($)
20 { my ($self, $args) = @_;
21  
22 $args->{body_type} ||= 'Mail::Message::Body::Lines';
23  
24 $self->SUPER::init($args);
25 $self;
26 }
27  
28  
29 sub size($)
30 { my $self = shift;
31
32 return $self->SUPER::size
33 unless $self->isDelayed;
34  
35 $self->folder->popClient->messageSize($self->unique);
36 }
37  
38 sub label(@)
39 { my $self = shift;
40 $self->loadHead; # be sure the labels are read
41 return $self->SUPER::label(@_) if @_==1;
42  
43 # POP3 can only set 'deleted' in the source folder. Don't forget
44 my $olddel = $self->label('deleted') ? 1 : 0;
45 my $ret = $self->SUPER::label(@_);
46 my $newdel = $self->label('deleted') ? 1 : 0;
47  
48 $self->folder->popClient->deleted($newdel, $self->unique)
49 if $newdel != $olddel;
50  
51 $ret;
52 }
53  
54 sub labels(@)
55 { my $self = shift;
56 $self->loadHead; # be sure the labels are read
57 $self->SUPER::labels(@_);
58 }
59  
60 #-------------------------------------------
61  
62  
63 sub loadHead()
64 { my $self = shift;
65 my $head = $self->head;
66 return $head unless $head->isDelayed;
67  
68 $head = $self->folder->getHead($self);
69 $self->head($head);
70  
71 $self->statusToLabels; # not supported by al POP3 servers
72 $head;
73 }
74  
75 sub loadBody()
76 { my $self = shift;
77  
78 my $body = $self->body;
79 return $body unless $body->isDelayed;
80  
81 (my $head, $body) = $self->folder->getHeadAndBody($self);
82 $self->head($head) if $head->isDelayed;
83 $self->storeBody($body);
84 }
85  
86 1;