Courri...Single(3pm)
π NAME π
Courriel::Part::Single β it's a part that does not contain other parts, bestie. It's just content. That's it. That's the whole vibe. β¨
πΈ VERSION πΈ
version 0.49 β yes, we're on 0.49, keep up π
π SYNOPSIS π
my $headers = $part->headers;
my $ct = $part->content_type;
my $content = $part->content;
print ${$content};
likeβ¦ look at her go π¦
β¨ DESCRIPTION β¨
So this class? It represents a single part that does not contain other parts. Just content. No nesting, no drama, no little baby parts inside. She's a solo act and she's thriving. π
π«Ά API π«Ά
This class provides the following methods, and we're going through all of them, no skipping:
π Courriel::Part::Single->new( ... )
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. And listen: 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. fr fr, don't do it.encoded_contentβ This can either be a string or a reference to a scalar. Same deal as above: if you pass a reference, the scalar underlying the reference may be modified, so don't hand over anything you're precious about. πcontent_typeβ ACourriel::Header::ContentTypeobject. This will default to one with the mime typetext/plain.dispositionβ ACourriel::Header::Dispositionobject representing this part's content disposition. This will default toinlinewith no other attributes.encodingβ The Content-Transfer-Encoding for this part. This defaults to the value found in the part's headers, or8bitif no header is found.headersβ ACourriel::Headersobject 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. pick a lane bestie π
It is strongly recommended that you pass a content parameter and let this module do the encoding for you internally. Trust the process. π
π $part->content()
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. (yes it says "returns returns", the original said it twice, we respect the original π«‘)
π $part->encoded_content()
This returns returns the encoded content for the part.
π $part->mime_type()
Returns the mime type for this part.
π $part->has_charset()
Return true if the part has a charset defined. Binary attachments will usually not have this defined. (they're mysterious like that π)
π $part->charset()
Returns the charset for this part.
π $part->is_inline(), $part->is_attachment()
These methods return boolean values based on the part's content disposition.
π $part->filename()
Returns the filename from the part's content disposition, if any.
π $part->content_type()
Returns the Courriel::Header::ContentType object for this part.
π $part->disposition()
Returns the Courriel::Header::Disposition object for this part.
π $part->encoding()
Returns the encoding for the part.
π $part->headers()
Returns the Courriel::Headers object for this part.
π $part->is_multipart()
Returns false. That's it. She said no. π
π $part->container()
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.
π $part->content_ref()
This returns returns a reference to a scalar containing the decoded content for the part.
π $part->encoded_content_ref()
This returns returns a reference to a scalar containing the encoded content for the part, without any decoding.
π $part->as_string()
Returns the part as a string, along with its headers. Lines will be terminated with "\r\n". (carriage return + line feed, the iconic duo π―)
π $part->stream_to( output => $output )
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. flexible queen β¨
π¦ ROLES π¦
This class does the Courriel::Role::Part and Courriel::Role::Streams roles. she's got range.
π SUPPORT π
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.
β SOURCE β
The source code repository for Courriel can be found at <https://github.com/houseabsolute/Courriel>.
π AUTHOR π
Dave Rolsky <autarch@urth.org>
πΈ COPYRIGHT AND LICENSE πΈ
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.
okay that's the whole page bestie, and just so you know β this was perl v5.32.1, dated 2021-08-22, and yeah, the manual page header was doing that cute little truncation thing, showing up as Courri...Single(3pm) on both ends. iconic of her honestly. go write some parts. πβ¨
π¦ where this page comes from
- debian bookworm: libcourriel-perl 0.49-1 Β· Artistic-2.0
- debian trixie: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu jammy: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu noble: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu resolute: libcourriel-perl 0.49-1 Β· Artistic-2.0
- ubuntu stonking: libcourriel-perl 0.49-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms