cs::MIME - handle Multipurpose Internet Mail Extension data
use cs::MIME;
This module implements methods for dealing with MIME data. It is a subclass of the cs::RFC822(3) module.
Parse a Content-Type line content-type, returning a tuple of (type,subtype,params,unparsed) being the type and subtype, a hashref containing any parameters on the line and any remaining data which could not be parsed.
Parse a the parameters section of a Content-Type line returning a tuple of (params,unparsed) a hashref containing any parameters on the line and any remaining data which could not be parsed.
Return a new cs::Source
containing the decoded content of the supplied cs::Source source
according to the supplied encoding string enc
(as for the Content-Encoding or Content-Transfer-Encoding headers)
and optional istext flag.
istext defaults to false for BASE64 data and true for QUOTED-PRINTABLE data.
Create a MIME object. If source (a file pathname or a cs::Source) is supplied then its content is copied and the headers extracted, leaving the source positioned just past the end of the body. To avoid this cost, call with no cs::Source and use the UseHdrs method to place header infomation into the object. The optional usecsize parameter says to trust the Content-Size header if present, placing a limit on the data read from the source. The default is to ignore it.
Type()
Return the type component of the object's Content-Type.
SubType()
Return the subtype component of the object's Content-Type.
Incorporate the headers from the cs::RFC822 object hdrs.
Read headers and body from the supplied source.
The optional usecsize parameter
says to trust the Content-Size header if present,
placing a limit on the data read from the source.
The default is to ignore it.
Supplying the optional sinkfile parameter
causes UseSource() to store the source in the named file sinkfile
instead of memory.
The optional parameter keepsink specifies whether the sinkfile
is to be unlinked on object destruction.
Return a string containing the body of this object, decoded if decoded is true (the default is false). The optional parameter istext is used as in the decodedSource() function.
Return a new cs::Source containing the body of this object, decoded if decoded is true (the default is false). The optional parameter istext is used as in the decodedSource() function.
Return the body for the Content-Type header. If the optional noparams is true, suppress the ``;param=value'' suffices.
Collect pretext, parts and posttext from the object (presumably multipart) and return an array of cs::MIME objects for each part. If the optional parameter wantPrePost is true, prefix the pretext and posttext to the array.
cs::RFC822(3), cs::Source(3)
RFCs: 822 - Internet Mail Messages, 1344 - Implications of MIME for Internet Mail Gateways, 1437 - The Extension of MIME Content-Types to a New Medium, 1521 - Media Type Registration Procedure
Cameron Simpson <cs@zip.com.au>