Mail::M...::String(3)

πŸ’– Mail::M...::String(3) πŸ’–

User Contributed Perl Documentation β€” yeah bestie, that's the manual name right there: Mail::M...::String(3), straight out of the perl docs, section 3. Buckle up, this one is a long ride and we're only on part one. πŸŽ€


✨ NAME ✨

Mail::Message::Body::String β€” the body of a Mail::Message, stored as one single string. That's it. That's the whole vibe. πŸ’…

🌈 INHERITANCE 🌈

Mail::Message::Body::String
  is a Mail::Message::Body
  is a Mail::Reporter

  Mail::Message::Body also extends Mail::Reporter
  is a Mail::Reporter

So it's giving generational trauma in the class hierarchy β€” this one inherits from Mail::Message::Body, which itself is a Mail::Reporter, and Mail::Message::Body also extends Mail::Reporter. Yes, Mail::Reporter shows up twice. That's not me being messy, that's the actual family tree. 🌳

πŸ“œ SYNOPSIS πŸ“œ

See Mail::Message::Body

That's the whole synopsis, bestie. No spoilers here, go read the parent class. πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so β€” the body (aka the content) of a message can be stored in various ways. This particular page is all about the extra functionality you unlock when a message is stored as a single scalar. πŸ“

Storing a whole message in one string is only a smart choice when the content is small, or when it's encoded. And even when it's stored as a scalar, you can still treat the body as if the data lives in lines or in an external file β€” but heads up, that'll be slower. Not tragic, just slower. ⭐

Extends "DESCRIPTION" in Mail::Message::Body.

πŸ”₯ OVERLOADED πŸ”₯

Extends "OVERLOADED" in Mail::Message::Body.

  • overload: '""' stringification β€” inherited, see "OVERLOADED" in Mail::Message::Body
  • overload: '==' numerical comparison β€” inherited, see "OVERLOADED" in Mail::Message::Body
  • overload: '@{}' addressed as array β€” inherited, see "OVERLOADED" in Mail::Message::Body
  • overload: bool true/false β€” inherited, see "OVERLOADED" in Mail::Message::Body

All four are inherited, so no new party tricks here, but they're still doing their thing in the background. πŸ‘‘

πŸ› οΈ METHODS πŸ› οΈ

Extends "METHODS" in Mail::Message::Body.

πŸŽ€ Constructors πŸŽ€

Extends "Constructors" in Mail::Message::Body.

  • $obj->clone() β€” inherited, see "Constructors" in Mail::Message::Body
  • $class->new(%options) β€” inherited, see "Constructors" in Mail::Message::Body

And here's the option menu for new(%options), exactly as it comes, no edits, no substitutions:

 -Option           --Defined in         --Default
  based_on           Mail::Message::Body  undef
  charset            Mail::Message::Body  'PERL'
  checked            Mail::Message::Body  false
  content_id         Mail::Message::Body  undef
  data               Mail::Message::Body  undef
  description        Mail::Message::Body  undef
  disposition        Mail::Message::Body  undef
  eol                Mail::Message::Body  'NATIVE'
  file               Mail::Message::Body  undef
  filename           Mail::Message::Body  undef
  language           Mail::Message::Body  undef
  message            Mail::Message::Body  undef
  mime_type          Mail::Message::Body  'text/plain'
  modified           Mail::Message::Body  false
  transfer_encoding  Mail::Message::Body  'none'

And now, one by one, the values each of those accepts:

  • based_on => $body
  • charset => $charset|'PERL'|<undef>
  • checked => BOOLEAN
  • content_id => STRING
  • data => \@lines|$text
  • description => STRING|$field
  • disposition => STRING|$field
  • eol => 'CR'|'LF'|'CRLF'|'NATIVE'
  • file => $file|$handle|$io
  • filename => $file
  • language => STRING|\@lang|$field
  • message => $message
  • mime_type => STRING|$field|$mime
  • modified => BOOLEAN
  • transfer_encoding => STRING|$field

Every single one defaults over in Mail::Message::Body, so this class is just vibing on what it inherited. πŸ’œ

πŸ’« Attributes πŸ’«

Extends "Attributes" in Mail::Message::Body.

  • $obj->charsetDetectAlgorithm( [CODE|undef|METHOD] ) β€” inherited, see "Attributes" in Mail::Message::Body::Encode

🧚 Constructing a body 🧚

Extends "Constructing a body" in Mail::Message::Body.

  • $obj->attach(@messages, %options) β€” inherited, see "Constructing a body" in Mail::Message::Body::Construct
  • $obj->charsetDetect(%options) β€” inherited, see "Constructing a body" in Mail::Message::Body::Encode
  • $obj->check() β€” inherited, see "Constructing a body" in Mail::Message::Body::Encode
  • $obj->concatenate(@components) β€” inherited, see "Constructing a body" in Mail::Message::Body::Construct
  • $obj->decoded(%options) β€” inherited, see "Constructing a body" in Mail::Message::Body
  • $obj->encode(%options) β€” inherited, see "Constructing a body" in Mail::Message::Body::Encode
  • $obj->encoded(%options) β€” inherited, see "Constructing a body" in Mail::Message::Body::Encode
  • $obj->eol( ['CR'|'LF'|'CRLF'|'NATIVE'] ) β€” inherited, see "Constructing a body" in Mail::Message::Body::Encode
  • $obj->foreachLine(CODE) β€” inherited, see "Constructing a body" in Mail::Message::Body::Construct
  • $obj->stripSignature(%options) β€” inherited, see "Constructing a body" in Mail::Message::Body::Construct
  • $obj->unify($body) β€” inherited, see "Constructing a body" in Mail::Message::Body::Encode

🫢 The body 🫢

Extends "The body" in Mail::Message::Body.

  • $obj->isDelayed() β€” inherited, see "The body" in Mail::Message::Body
  • $obj->isMultipart() β€” inherited, see "The body" in Mail::Message::Body
  • $obj->isNested() β€” inherited, see "The body" in Mail::Message::Body
  • $obj->message( [$message] ) β€” inherited, see "The body" in Mail::Message::Body
  • $obj->partNumberOf($part) β€” inherited, see "The body" in Mail::Message::Body

🌸 About the payload 🌸

Extends "About the payload" in Mail::Message::Body.

  • $obj->charset() β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->checked( [BOOLEAN] ) β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->contentId( [STRING|$field] ) β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->description( [STRING|$field] ) β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->disposition( [STRING|$field] ) β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->dispositionFilename( [$directory] ) β€” inherited, see "About the payload" in Mail::Message::Body::Encode
  • $obj->isBinary() β€” inherited, see "About the payload" in Mail::Message::Body::Encode
  • $obj->isText() β€” inherited, see "About the payload" in Mail::Message::Body::Encode
  • $obj->language( [@langs|\@langs|$langs|$field] ) β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->mimeType() β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->nrLines() β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->size() β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->transferEncoding( [STRING|$field] ) β€” inherited, see "About the payload" in Mail::Message::Body
  • $obj->type( [STRING|$field] ) β€” inherited, see "About the payload" in Mail::Message::Body

πŸ’€ Access to the payload πŸ’€

Extends "Access to the payload" in Mail::Message::Body.

  • $obj->endsOnNewline() β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->file() β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->lines() β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->print( [$fh] ) β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->printEscapedFrom($fh) β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->string() β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->stripTrailingNewline() β€” inherited, see "Access to the payload" in Mail::Message::Body
  • $obj->write(%options) β€” inherited, see "Access to the payload" in Mail::Message::Body

🧠 Internals 🧠

Extends "Internals" in Mail::Message::Body.

  • $any->addTransferEncHandler( $name, <$class|$object> ) β€” inherited, see "Internals" in Mail::Message::Body::Encode
  • $obj->contentInfoFrom($head) β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->contentInfoTo($head) β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->fileLocation( [$begin, $end] ) β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->getTransferEncHandler($type) β€” inherited, see "Internals" in Mail::Message::Body::Encode
  • $obj->isModified() β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->load() β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->modified( [BOOLEAN] ) β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->moveLocation( [$distance] ) β€” inherited, see "Internals" in Mail::Message::Body
  • $obj->read( $parser, $head, $bodytype, [$chars, [$lines]] ) β€” inherited, see "Internals" in Mail::Message::Body

😭 Error handling 😭

Extends "Error handling" in Mail::Message::Body.

  • $obj->AUTOLOAD() β€” inherited, see "Error handling" in Mail::Message::Body
  • $obj->notImplemented() β€” inherited, see "Error handling" in Mail::Reporter
  • $obj->notImplemented() β€” inherited, see "Error handling" in Mail::Reporter
Not me listing notImplemented() twice. πŸ‘€ That's genuinely how it appears in the original β€” both entries, both pointing at Mail::Reporter, both staying. No cap.

🧹 Cleanup 🧹

Extends "Cleanup" in Mail::Message::Body.

  • $obj->DESTROY() β€” inherited, see "Cleanup" in Mail::Reporter
  • $obj->DESTROY() β€” inherited, see "Cleanup" in Mail::Reporter
And yes, DESTROY() is duplicated too. Twice. We don't question the ancestors, we just document them faithfully. πŸ’…

πŸ” DETAILS πŸ”

Extends "DETAILS" in Mail::Message::Body.


okay bestie that's the end of part one β€” there's more coming, don't go anywhere πŸ’–

πŸ’€ DIAGNOSTICS πŸ’€

Okay bestie, this is the part where the module talks back. Every single one of these messages is a little love note from the internals, and lowkey you will meet some of them. Here's the full roster, no skips, no cuts:

  • Warning: Content-Transfer-Encoding '$te' requires explicit charset, defaulted to utf-8. β€” Cast by encode(). So like, the transfer encoding you picked was being mysterious about its charset, and the module just went "fine, utf-8 it is" without asking you. Rude? A little. Convenient? Also yes.
  • Fault: Unable to read file $name for message body scalar: $! β€” Cast by new(). You asked for a Mail::Message::Body::String built from a named file, but the file said "not today" and could not be read to grab the lines inside. The $! is your error variable telling you why.
  • Error: cannot concatenate element $which β€” Cast by concatenate(). The concatenation vibe check failed, specifically on the element named by $which.
  • Fault: cannot open $file to write body: $! β€” Cast by write(). Couldn't open that file to write the body into. Check your perms, bestie, and check $!.
  • Warning: charset '$name' is not known. β€” Cast by encode(). You hit a character set that Perl's Encode module has literally never heard of while encoding or decoding a message body. It's giving "who is she".
  • Error: class $package does not implement method $method. β€” Cast by notImplemented(). Fatal error. The specific $package (or one of its superclasses) doesn't implement this method where it really should. Which means some other related classes do implement it, but this one just… doesn't. Investigate it, and probably tell the author of the package. Fr fr.
  • Error: class $package does not implement method $method. β€” Cast by notImplemented(). Fatal error. The specific $package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. (Yes, it's listed twice in the original β€” no, I'm not merging them, that would be a crime. πŸ’…)
  • Fault: error closing $file after write body: $! β€” Cast by write(). The writing went fine, the closing did not. Awkward.
  • Warning: no decoder defined for transfer encoding '$encoding'. β€” Cast by encode(). Your message body is encoded in a way nothing here understands, so no decoding (and no recoding) can happen. Sorry babe, we're stuck with it as-is.
  • Warning: no encoder defined for transfer encoding '$encoding'. β€” Cast by encode(). The body got decoded just fine, but the encoding you want is unknown. The decoded data is returned to you anyway, so at least you're not empty-handed. 🫢
  • Error: no filename parameter for write() body. β€” Cast by write(). You called write() with no filename. The body has nowhere to go. It's homeless. Give it a filename.
  • Error: part number needs multi-part or nested. β€” Cast by partNumberOf(). You asked for a part number on something that isn't a multi-part and isn't nested. The math cannot math.
  • Error: unknown line terminator '$eol'. β€” Cast by eol(). That line terminator? Not one it recognizes. Iconic of you to try though.

🌈 SEE ALSO 🌈

This module is part of Mail-Message version 4.04, built on February 04, 2026. Website: http://perl.overmeer.net/CPAN/


πŸ‘‘ LICENSE πŸ‘‘

For contributors, see file ChangeLog. ✨

This software is copyright (c) 2001-2026 by Mark Overmeer. πŸŽ€

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Slay. πŸ’–


And that's the whole page, bestie! πŸ¦‹ Generated by perl v5.42.0 on 2026-02-05, for the Mail::M...::String(3) manual. Go forth and encode responsibly. Periodt. πŸ’…πŸŒΈ
πŸ“¦ where this page comes from