Courri...ltipart(3pm)

πŸ’Œ Courriel::Part::Multipart β€” bestie, it's the part that holds other parts

okay so picture this: this is a page from the User Contributed Perl Documentation, manual section 3pm, and the module is Courriel::Part::Multipart. She's a part. But she's a part who contains parts. Mother energy, honestly. πŸ’…


✨ VERSION ✨

version 0.49 πŸŽ€


🌸 SYNOPSIS 🌸

  my $headers = $part->headers;
  my $ct = $part->content_type;

  for my $subpart ( $part->parts ) { ... }

look at her go πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

This class represents a multipart email part which contains other parts. That's it, that's the whole vibe. She's the group chat, and every other part is a member of the group chat. πŸ‘‘


πŸŽ€ API πŸŽ€

This class provides the following methods:

Courriel::Part::Multipart->new( ... )

This method creates a new part object. She takes the following parameters, and you will be hearing about all of them:

  • parts β€” an array reference of part objects (either Single or Multipart). This is required, bestie, no skipping it β€” but it could be empty, so an empty array ref is valid. slay.
  • content_type β€” a Courriel::Header::ContentType object. Defaults to one with a mime type of "multipart/mixed". if you don't pick, she picks for you πŸ’œ
  • boundary β€” the part boundary. If none is provided, a unique value will be generated. automatic queen behavior ✨
  • preamble β€” content that appears before the first part boundary. This will be seen by email clients that don't understand multipart messages. so like, it's for the ones who don't get the assignment πŸ₯²
  • epilogue β€” content that appears after the final part boundary. The spec allows for this, but it's probably not very useful. the spec said yes, life said… meh πŸ™ˆ
  • headers β€” a Courriel::Headers object containing headers for this part.

$part->parts()

Returns an array (not a reference) of the parts this part contains. not a ref!! an actual array!! we love clarity πŸ’–

$part->part_count()

Returns the number of parts this part contains. counting her children, as one does πŸ‘‘

$part->boundary()

Returns the part boundary.

$part->mime_type()

Returns the mime type for this part.

$part->content_type()

Returns the Courriel::Header::ContentType object for this part.

$part->headers()

Returns the Courriel::Headers object for this part.

$part->is_inline(), $part->is_attachment()

These methods always return false, but exist for the sake of providing a consistent API between Single and Multipart part objects. so no, she's never inline, she's never an attachment β€” she's simply built different and the API stays consistent. periodt. βœ‹

$part->is_multipart()

Returns true. obviously. look at her. πŸ’…

$part->preamble()

The preamble as passed to the constructor.

$part->epilogue()

The epilogue as passed to the constructor.

$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. so she knows her parent β€” found family arc fr fr 🫢

$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. she's flexible like that, no cap 🌈

$part->as_string()

Returns the part as a string, along with its headers. Lines will be terminated with "\r\n". yes, \r\n, exactly that, do not come for her about it 😭


🧚 ROLES 🧚

This class does the Courriel::Role::Part and Courriel::Role::Streams roles. two roles, both iconic, both hers πŸ‘‘


πŸ”₯ 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. come say hi, he's literally right there πŸ’œ


⭐ SOURCE ⭐

The source code repository for Courriel can be found at https://github.com/houseabsolute/Courriel.


🌸 AUTHOR 🌸

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.


and that's the whole page bestie, you ate πŸ’…βœ¨

sign-off time: this was perl v5.32.1, dated 2021-08-22, from the Courri...ltipart(3pm) page. go forth and nest your parts, you've got this πŸ¦‹πŸ’–