/usr/share/perl5/Mail/Message/Body/Nested.pm is in libmail-box-perl 2.117-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | # Copyrights 2001-2014 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use strict;
use warnings;
package Mail::Message::Body::Nested;
use vars '$VERSION';
$VERSION = '2.117';
use base 'Mail::Message::Body';
use Mail::Message::Body::Lines;
use Mail::Message::Part;
use Carp;
sub init($)
{ my ($self, $args) = @_;
$args->{mime_type} ||= 'message/rfc822';
$self->SUPER::init($args);
my $nested;
if(my $raw = $args->{nested})
{ $nested = Mail::Message::Part->coerce($raw, $self);
croak 'Data not convertible to a message (type is ', ref $raw,")\n"
unless defined $nested;
}
$self->{MMBN_nested} = $nested;
$self;
}
sub isNested() {1}
sub isBinary() { shift->nested->body->isBinary }
sub clone()
{ my $self = shift;
ref($self)->new
( $self->logSettings
, based_on => $self
, nested => $self->nested->clone
);
}
sub nrLines() { shift->nested->nrLines }
sub size() { shift->nested->size }
sub string()
{ my $nested = shift->nested;
defined $nested ? $nested->string : '';
}
sub lines()
{ my $nested = shift->nested;
defined $nested ? ($nested->lines) : ();
}
sub file()
{ my $nested = shift->nested;
defined $nested ? $nested->file : undef;
}
sub print(;$)
{ my $self = shift;
$self->nested->print(shift || select);
}
sub partNumberOf($)
{ my ($self, $part) = @_;
$self->message->partNumber;
}
sub foreachLine($)
{ my ($self, $code) = @_;
$self->log(ERROR => "You cannot use foreachLine on a nested");
confess;
}
sub check() { shift->forNested( sub {$_[1]->check} ) }
sub encode(@)
{ my ($self, %args) = @_;
$self->forNested( sub {$_[1]->encode(%args)} );
}
sub encoded() { shift->forNested( sub {$_[1]->encoded} ) }
sub read($$$$)
{ my ($self, $parser, $head, $bodytype) = @_;
my $nest = Mail::Message::Part->new(container => undef);
$nest->readFromParser($parser, $bodytype)
or return;
$nest->container($self);
$self->{MMBN_nested} = $nest;
$self;
}
sub fileLocation()
{ my $nested = shift->nested;
( ($nested->head->fileLocation)[0]
, ($nested->body->fileLocation)[1]
);
}
sub endsOnNewline() { shift->nested->body->endsOnNewline }
sub moveLocation($)
{ my $self = shift;
my $nested = $self->nested;
my $dist = shift or return $self; # no move
$nested->head->moveLocation($dist);
$nested->body->moveLocation($dist);
$self;
}
sub nested() { shift->{MMBN_nested} }
sub forNested($)
{ my ($self, $code) = @_;
my $nested = $self->nested;
my $body = $nested->body;
my $new_body = $code->($self, $body)
or return;
return $self if $new_body == $body;
my $new_nested = Mail::Message::Part->new
( head => $nested->head->clone
, container => undef
);
$new_nested->body($new_body);
my $created = (ref $self)->new
( based_on => $self
, nested => $new_nested
);
$new_nested->container($created);
$created;
}
sub toplevel() { my $msg = shift->message; $msg ? $msg->toplevel : undef}
1;
|