File Coverage

blib/lib/Mail/Message/Head/Delayed.pm
Criterion Covered Total %
statement 24 33 72.7
branch 1 4 25.0
condition 0 3 0.0
subroutine 9 13 69.2
pod 6 7 85.7
total 40 60 66.6


line stmt bran cond sub pod time code
1             # This code is part of Perl distribution Mail-Box version 4.01.
2             # The POD got stripped from this file by OODoc version 3.05.
3             # For contributors see file ChangeLog.
4              
5             # This software is copyright (c) 2001-2025 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::Message::Head::Delayed;{
13             our $VERSION = '4.01';
14             }
15              
16 14     14   163 use parent 'Mail::Message::Head';
  14         33  
  14         107  
17              
18 14     14   1251 use strict;
  14         62  
  14         459  
19 14     14   107 use warnings;
  14         27  
  14         1122  
20              
21 14     14   92 use Log::Report 'mail-box', import => [ qw/__x error/ ];
  14         27  
  14         110  
22              
23             use Object::Realize::Later
24 14         177 becomes => 'Mail::Message::Head::Complete',
25             realize => 'load',
26 14     14   2867 believe_caller => 1;
  14         59  
27              
28 14     14   10162 use Scalar::Util qw/weaken/;
  14         36  
  14         7488  
29              
30             #--------------------
31              
32 0     0 1 0 sub build(@) { error __x"cannot build() a delayed header." }
33              
34             sub init($$)
35 737     737 0 7824 { my ($self, $args) = @_;
36 737         2135 $self->SUPER::init($args);
37              
38 737 50       14210 if(defined $args->{message})
39 0         0 { $self->{MMHD_message} = $args->{message};
40 0         0 weaken($self->{MMHD_message});
41             }
42              
43 737         3915 $self;
44             }
45              
46             sub modified(;$)
47 0 0 0 0 1 0 { return 0 if @_==1 || !$_[1];
48 0         0 $_[0]->forceRealize->modified(1);
49             }
50              
51             sub isDelayed() { 1 }
52             sub isModified() { 0 }
53             sub isEmpty() { 0 }
54              
55             #--------------------
56              
57 154     154 1 1317 sub get($;$) { shift->load->get(@_) }
58              
59             #--------------------
60              
61             sub guessBodySize() { undef }
62              
63              
64             sub guessTimestamp() { undef }
65              
66             #--------------------
67              
68             sub read($)
69 0     0 1 0 { my ($self, $parser, $headtype, $bodytype) = @_;
70              
71             # $parser->skipHeader not implemented... returns where
72 0         0 $self->{MMH_where} = 0;
73 0         0 $self;
74             }
75              
76 408     408 1 73530 sub load() { $_[0] = $_[0]->message->loadHead }
77              
78              
79 0     0 1   sub setNoRealize($) { error __x"attempt to set field on a delayed header." }
80              
81             1;