[Cover] [Previous Section] [Next Section] [Index]
Current chapter: Perl MIME Utilities: MultipartMsg Class
Section 51 out of 79 total sections
, Section 4 out of 4 sections in this chapter
Methods
The MultipartMsg class provides the following methods.
new()
Description
Creates a new multipart message. Calling this method is a prerequisite for calling any other method of this class.
Arguments
|
Argument
|
Meaning
|
$header
|
(hash reference) The initial header of the message.
|
$preamble
|
(string) The initial preamble.
|
$subParts
|
(array reference) The initial subParts.
|
$epilogue
|
(string) The initial epilogue (optional).
|
Returns
|
Value
|
Meaning
|
$self
|
Returns a reference to the MultipartMsg object on success
|
undef
|
Returns undef if called with invalid arguments
|
Example
$msg = MultipartMsg->new({"Content-type" => "multipart/mixed"},
"", [], "");
setBody()
Description
Dummy method that catches an illegal attempt to set the body of a multipart message. You can't set the body; you can only set the preamble and epilogue, or add subparts.
setPreamble()
Description
Sets the preamble of the body of a multipart message.
Synopsis
require MsgEntity;
...
$msg->setPreamble($preamble);
Arguments
|
Argument
|
Meaning
|
$preamble
|
(string) The new preamble of the message.
|
Example
$msg->setPreamble("This is the new preamble");
setEpilogue()
Description
Sets the epilogue of the body of a multipart message.
Synopsis
require MsgEntity;
...
$msg->setEpilogue($epilogue);
Arguments
|
Argument
|
Meaning
|
$epilogue
|
(string) The new epilogue of the message.
|
Example
$msg->setEpilogue("This is the new epilogue");
appendSubpart()
Description
Add a subpart to the multipart message. The subpart is appended after all the existing subparts.
Synopsis
require MsgEntity;
...
$msg->appendSubpart($subMsg);
$msg->appendSubpart($subpart1, $subpart2, $subpart3);
Arguments
|
Argument
|
Meaning
|
subPart,...
|
(MsgEntity) The subpart(s) to add.
|
Example
$msg->appendSubpart($subMsg);
$msg->appendSubpart($subpart1, $subpart2, $subpart3);
asString()
Description
Converts the multipart message to a string for printing.
Returns
|
Value
|
Meaning
|
$content
|
The entire message as a single scalar string.
|
Example
$content = $msg->asString();
Caveats
On non-Unix systems, call "binmode" on a file descriptor before writing this string out to it.
[Cover] [Previous Section] [Next Section] [Index]
Current chapter: Perl MIME Utilities: MultipartMsg Class
Section 51 out of 79 total sections
, Section 4 out of 4 sections in this chapter
Copyright © 1999, Unwired Planet, Inc. All rights
reserved.