File Coverage

blib/lib/Mail/Box/Net/Message.pm
Criterion Covered Total %
statement 18 54 33.3
branch 0 16 0.0
condition n/a
subroutine 6 10 60.0
pod 2 4 50.0
total 26 84 30.9


line stmt bran cond sub pod time code
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::Net::Message;
10 1     1   969 use vars '$VERSION';
  1         2  
  1         55  
11             $VERSION = '3.009';
12              
13 1     1   5 use base 'Mail::Box::Message';
  1         2  
  1         136  
14              
15 1     1   8 use strict;
  1         5  
  1         26  
16 1     1   4 use warnings;
  1         2  
  1         25  
17              
18 1     1   5 use File::Copy;
  1         1  
  1         63  
19 1     1   7 use Carp;
  1         2  
  1         473  
20              
21              
22             sub init($)
23 0     0 0   { my ($self, $args) = @_;
24              
25 0           $self->SUPER::init($args);
26              
27 0           $self->unique($args->{unique});
28 0           $self;
29             }
30              
31             #-------------------------------------------
32              
33              
34             sub unique(;$)
35 0     0 1   { my $self = shift;
36 0 0         @_ ? $self->{MBNM_unique} = shift : $self->{MBNM_unique};
37             }
38              
39             #-------------------------------------------
40              
41              
42             #-------------------------------------------
43              
44             sub loadHead()
45 0     0 0   { my $self = shift;
46 0           my $head = $self->head;
47 0 0         return $head unless $head->isDelayed;
48              
49 0           my $folder = $self->folder;
50 0           $folder->lazyPermitted(1);
51              
52 0 0         my $parser = $self->parser or return;
53 0           $self->readFromParser($parser);
54              
55 0           $folder->lazyPermitted(0);
56              
57 0           $self->log(PROGRESS => 'Loaded delayed head.');
58 0           $self->head;
59             }
60              
61             #-------------------------------------------
62              
63              
64             sub loadBody()
65 0     0 1   { my $self = shift;
66              
67 0           my $body = $self->body;
68 0 0         return $body unless $body->isDelayed;
69              
70 0           my $head = $self->head;
71 0 0         my $parser = $self->parser or return;
72              
73 0 0         if($head->isDelayed)
74 0           { $head = $self->readHead($parser);
75 0 0         if(defined $head)
76 0           { $self->log(PROGRESS => 'Loaded delayed head.');
77 0           $self->head($head);
78             }
79             else
80 0           { $self->log(ERROR => 'Unable to read delayed head.');
81 0           return;
82             }
83             }
84             else
85 0           { my ($begin, $end) = $body->fileLocation;
86 0           $parser->filePosition($begin);
87             }
88              
89 0           my $newbody = $self->readBody($parser, $head);
90 0 0         unless(defined $newbody)
91 0           { $self->log(ERROR => 'Unable to read delayed body.');
92 0           return;
93             }
94              
95 0           $self->log(PROGRESS => 'Loaded delayed body.');
96 0           $self->storeBody($newbody->contentInfoFrom($head));
97             }
98              
99             #-------------------------------------------
100              
101             1;