Courriel::Part::Single - A part which does not contain other parts, only content
version 0.49
my $headers = $part->headers; my $ct = $part->content_type; my $content = $part->content; print ${$content};
This class represents a single part that does not contain other parts, just content.
This class provides the following methods:
This method creates a new part object. It accepts the following parameters:
content
This can either be a string or a reference to a scalar. It should be a character string, not a byte string.
If you pass a reference, then the scalar underlying the reference may be modified, so don't pass in something you don't want modified.
encoded_content
This can either be a string or a reference to a scalar.
content_type
A Courriel::Header::ContentType object. This will default to one with the mime type "text/plain".
disposition
A Courriel::Header::Disposition object representing this part's content disposition. This will default to "inline" with no other attributes.
encoding
The Content-Transfer-Encoding for this part. This defaults to the value found in the part's headers, or "8bit" if no header is found.
headers
A Courriel::Headers object containing headers for this part.
You must pass a content or encoded_content value when creating a new part, but there's really no point in passing both.
It is strongly recommended that you pass a content parameter and letting this module do the encoding for you internally.
This returns returns the decoded content for the part. It will be in Perl's native utf-8 encoding, decoded from whatever character set the content is in.
This returns returns the encoded content for the part.
Returns the mime type for this part.
Return true if the part has a charset defined. Binary attachments will usually not have this defined.
Returns the charset for this part.
These methods return boolean values based on the part's content disposition.
Returns the filename from the part's content disposition, if any.
Returns the Courriel::Header::ContentType object for this part.
Returns the Courriel::Header::Disposition object for this part.
Returns the encoding for the part.
Returns the Courriel::Headers object for this part.
Returns false.
Returns the Courriel or Courriel::Part::Multipart object to which this part belongs, if any. This is set when the part is added to another object.
This returns returns a reference to a scalar containing the decoded content for the part.
This returns returns a reference to a scalar containing the encoded content for the part, without any decoding.
Returns the part as a string, along with its headers. Lines will be terminated with "\r\n".
This method will send the stringified part to the specified output. The output can be a subroutine reference, a filehandle, or an object with a print() method. The output may be sent as a single string, as a list of strings, or via multiple calls to the output.
print()
This class does the Courriel::Role::Part and Courriel::Role::Streams roles.
Courriel::Role::Part
Courriel::Role::Streams
Bugs may be submitted at https://github.com/houseabsolute/Courriel/issues.
I am also usually active on IRC as 'autarch' on irc://irc.perl.org.
irc://irc.perl.org
The source code repository for Courriel can be found at https://github.com/houseabsolute/Courriel.
Dave Rolsky <autarch@urth.org>
This software is Copyright (c) 2021 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
The full text of the license can be found in the LICENSE file included with this distribution.
To install Courriel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Courriel
CPAN shell
perl -MCPAN -e shell install Courriel
For more information on module installation, please visit the detailed CPAN module installation guide.