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 theBODYis empty, the construction of the object fails:undefis 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 => $charsetencoding => 'q'|'Q'|'b'|'B'force => BOOLEANlanguage => $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 bynotImplemented() - 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 bytoInt() - 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 byencode() - 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
- fedora 44: perl-Mail-Message 4.04-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms