Mail::M...uctured(3)

πŸ’– Mail::Message::Field::Unstructured πŸ’–

okay bestie, gather round, because we're talking about Mail::Message::Field::Unstructured β€” the smart unstructured field ✨ (yes, that's literally its whole deal, "smart unstructured field", iconic).

This page lives in the Mail::Message::Field::Unstructured(3) corner of the perl docs, under User Contributed Perl Documentation, and it is fr fr a whole vibe. Let's go 🫢


🌸 INHERITANCE 🌸

the family tree, so you know who raised it:

Mail::Message::Field::Unstructured
  is a Mail::Message::Field::Full
  is a Mail::Message::Field
  is a Mail::Reporter

four generations of iconic lineage, no cap πŸ‘‘


✨ SYNOPSIS ✨

here's the whole mood in one line:

my $f = Mail::Message::Field::Unstructured->new('Comments', 'hi!');

that's it. that's the vibe. slay πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so. unstructured fields. they contain information that is not restricted in any way. literally zero restrictions, live your truth 🌈

RFC2822 defines some unstructured fields, but by default all the unknown fields are unstructured too β€” they just show up and nobody's gatekeeping them.

things like attributes and comments have no meaning for unstructured fields. like, none. they're not invited to the party πŸ™ˆ

but encoding absolutely does mean something here. encoding is the main character. ✨

Extends "DESCRIPTION" in Mail::Message::Field::Full.


πŸŽ€ OVERLOADED πŸŽ€

Extends "OVERLOADED" in Mail::Message::Field::Full.

here's every overload, and ngl they're all inherited β€” the parent classes did the work and we're reaping the benefits πŸ’–

  • overload: "" β€” stringification. Inherited, see "OVERLOADED" in Mail::Message::Field::Full.
  • overload: '""' β€” stringification. Inherited, see "OVERLOADED" in Mail::Message::Field.
  • overload: '0+' β€” numification. Inherited, see "OVERLOADED" in Mail::Message::Field.
  • overload: '<='> β€” numeric comparison. Inherited, see "OVERLOADED" in Mail::Message::Field.
  • overload: bool β€” boolean. Inherited, see "OVERLOADED" in Mail::Message::Field.
  • overload: cmp β€” string comparison. Inherited, see "OVERLOADED" in Mail::Message::Field.

πŸ”₯ METHODS πŸ”₯

Extends "METHODS" in Mail::Message::Field::Full.

⭐ Constructors ⭐

Extends "Constructors" in Mail::Message::Field::Full.

  • $obj->clone() β€” Inherited, see "Constructors" in Mail::Message::Field.
  • $class->from($field, %options) β€” Inherited, see "Constructors" in Mail::Message::Field::Full.
  • $class->new($data) β€” okay so this one's the real one, listen up πŸ‘‡

when the $data is specified as a single line, the content part is considered to be correctly (character) encoded and escaped. typically, it's a line as read from file. the folding of the line is kept as is β€” we do not touch it, we do not fold it, we leave it exactly how we found it 🫢

in case more than one argument is provided, the second one is considered the BODY. attributes and other special things are not defined for unstructured fields, and therefore not valid options. no extras for you, bestie. the BODY can be:

  • a single string
  • a single OBJECT
  • or an array of OBJECTS

the objects get stringified (into a comma separated list). each BODY element is interpreted with the specified encoding.

🚨 when the BODY is empty, the construction of the object fails: undef is returned. so like, no body no field, that's the rule πŸ’€

Improves base, see "METHODS" in Mail::Message::Field::Full.

here's the options table, vibes only:

 -Option  --Defined in                --Default
  charset   Mail::Message::Field::Full  undef
  encoding  Mail::Message::Field::Full  'q'
  force     Mail::Message::Field::Full  false
  language  Mail::Message::Field::Full  undef
  • charset => $charset
  • encoding => 'q'|'Q'|'b'|'B'
  • force => BOOLEAN
  • language => $language

Β» example:

my $s = Mail::Message::Field::Unstructured->new('Comment', 'Hi!');

# Use autodetect
my $s = Mail::Message::Field::Full->new('Comment', 'Hi!');
my $s = Mail::Message::Field::Full->new('Comment: Hi!');

🌈 Attributes 🌈

Extends "Attributes" in Mail::Message::Field::Full.

  • $obj->Name() β€” Inherited, see "Attributes" in Mail::Message::Field.
  • $obj->body() β€” Inherited, see "Attributes" in Mail::Message::Field.
  • $obj->folded() β€” Inherited, see "Attributes" in Mail::Message::Field.
  • $obj->foldedBody( [$body] ) β€” Inherited, see "Attributes" in Mail::Message::Field.
  • $obj->name() β€” Inherited, see "Attributes" in Mail::Message::Field.
  • $obj->unfoldedBody( [$body, [$wrap]] ) β€” Inherited, see "Attributes" in Mail::Message::Field.
  • $obj->wellformedName( [STRING] ) β€” Inherited, see "Attributes" in Mail::Message::Field.

πŸ’œ The field πŸ’œ

Extends "The field" in Mail::Message::Field::Full.

  • $any->isStructured( [$name] ) β€” Inherited, see "The field" in Mail::Message::Field.
  • $obj->length() β€” Inherited, see "The field" in Mail::Message::Field.
  • $obj->nrLines() β€” Inherited, see "The field" in Mail::Message::Field.
  • $obj->print( [$fh] ) β€” Inherited, see "The field" in Mail::Message::Field.
  • $obj->size() β€” Inherited, see "The field" in Mail::Message::Field.
  • $obj->string( [$wrap] ) β€” Inherited, see "The field" in Mail::Message::Field.
  • $obj->toDisclose() β€” Inherited, see "The field" in Mail::Message::Field.

πŸ“ Access to the body πŸ“

Extends "Access to the body" in Mail::Message::Field::Full.

  • $obj->decodedBody(%options) β€” Inherited, see "Access to the body" in Mail::Message::Field::Full.

🧚 Access to the content 🧚

Extends "Access to the content" in Mail::Message::Field::Full.

  • $obj->addresses() β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $obj->attribute( $name, [$value] ) β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $obj->attributes() β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $obj->beautify() β€” Inherited, see "Access to the content" in Mail::Message::Field::Full.
  • $obj->comment( [STRING] ) β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $any->createComment(STRING, %options) β€” Inherited, see "Access to the content" in Mail::Message::Field::Full.
  • $any->createPhrase(STRING, %options) β€” Inherited, see "Access to the content" in Mail::Message::Field::Full.
  • $any->dateToTimestamp(STRING) β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $any->stripCFWS( [STRING] ) β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $obj->study() β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $any->toDate( [$time] ) β€” Inherited, see "Access to the content" in Mail::Message::Field.
  • $obj->toInt() β€” Inherited, see "Access to the content" in Mail::Message::Field.

πŸ’€ Internals πŸ’€

Extends "Internals" in Mail::Message::Field::Full.

  • $any->decode(STRING, %options) β€” Inherited, see "Internals" in Mail::Message::Field::Full.
  • $obj->encode(STRING, %options) β€” Inherited, see "Internals" in Mail::Message::Field::Full.

πŸ’– Parsing πŸ’–

Extends "Parsing" in Mail::Message::Field::Full.

  • $obj->consume( $line | <$name,<$body|$objects>> ) β€” Inherited, see "Parsing" in Mail::Message::Field.
  • $any->consumeComment(STRING) β€” Inherited, see "Parsing" in Mail::Message::Field::Full.
  • $obj->consumeDotAtom(STRING) β€” Inherited, see "Parsing" in Mail::Message::Field::Full.
  • $any->consumePhrase(STRING) β€” Inherited, see "Parsing" in Mail::Message::Field::Full.
  • $obj->defaultWrapLength( [$length] ) β€” Inherited, see "Parsing" in Mail::Message::Field.
  • $any->fold( $name, $body, [$maxchars] ) β€” Inherited, see "Parsing" in Mail::Message::Field.
  • $obj->parse(STRING) β€” Inherited, see "Parsing" in Mail::Message::Field::Full.
  • $obj->produceBody() β€” Inherited, see "Parsing" in Mail::Message::Field::Full.
  • $obj->setWrapLength( [$length] ) β€” Inherited, see "Parsing" in Mail::Message::Field.
  • $obj->stringifyData(STRING|ARRAY|$objects) β€” Inherited, see "Parsing" in Mail::Message::Field.
  • $obj->unfold(STRING) β€” Inherited, see "Parsing" in Mail::Message::Field.

😭 Error handling 😭

Extends "Error handling" in Mail::Message::Field::Full.

  • $obj->AUTOLOAD() β€” Inherited, see "Error handling" in Mail::Reporter.
  • $obj->notImplemented() β€” Inherited, see "Error handling" in Mail::Reporter.

πŸŽ€ Cleanup πŸŽ€

Extends "Cleanup" in Mail::Message::Field::Full.

  • $obj->DESTROY() β€” Inherited, see "Cleanup" in Mail::Reporter.

πŸ‘‘ DETAILS πŸ‘‘

Extends "DETAILS" in Mail::Message::Field::Full.

that's literally it. nothing extra here. the parent said it all πŸ’…


🚨 DIAGNOSTICS 🚨

okay this is the part where we get real. every one of these, no skipping:

  • Warning: attributes are not supported for unstructured fields. Cast by new()
  • Error: class $package does not implement method $method. 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. Cast by notImplemented()
  • Warning: field content is not numerical: $content the numeric value of a field is requested (for instance the "Lines" or "Content-Length" fields should be numerical), however the data contains weird characters. Cast by toInt()
  • Error: field name too long (max $count), in '$name'. it is not specified in the RFCs how long a field name can be, but at least it should be a few characters shorter than the line wrap. Cast by fold()
  • Warning: illegal character in charset '$name'. the field is created with an utf8 string which only contains data from the specified character set. however, that character set can never be a valid name because it contains characters which are not permitted. Cast by encode()
  • Warning: illegal character in field name $name. a new field is being created which does contain characters not permitted by the RFCs. using this field in messages may break other e-mail clients or transfer agents, and therefore mutulate or extinguish your message. Cast by consume()
  • Warning: illegal character in language '$name'. the field is created with data which is specified to be in a certain language, however, the name of the language cannot be valid: it contains characters which are not permitted by the RFCs. Cast by encode()
  • Warning: illegal encoding '$name', using 'q'. the RFCs only permit base64 ("b " or "B ") or quoted-printable ("q" or "Q") encoding. other than these four options are illegal. Cast by encode()
  • Warning: no extras for unstructured fields. Cast by new()

🌟 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.


and that's the whole page bestie 🫢 built with perl v5.42.0, dated 2026-02-05, and honestly? iconic behavior. go forth and have zero restrictions on your unstructured fields πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from