NAME

Mail::Make::Headers::Generic - Base Class for Mail::Make Header Objects

SYNOPSIS

package Mail::Make::Headers::MyHeader;
use parent qw( Mail::Make::Headers::Generic );

VERSION

v0.1.0

DESCRIPTION

This is the base class for all typed header objects in Mail::Make. It provides shared infrastructure for header value parsing, parameter handling, RFC 2231 filename encoding/decoding, and stringification.

METHODS

as_string

Returns the header field value as a string, suitable for inclusion in a mail message.

field_name

Sets or gets the header field name (e.g. Content-Type).

param( $name [, $value ] )

Sets or gets a named parameter on the header value. For example the charset parameter of a Content-Type field.

params( $name => $value, ... )

Sets multiple parameters at once. With no arguments, returns the parameter hash object.

value( [ $value ] )

Sets or gets the main header value (the part before the first ;).

PRIVATE METHODS

_filename_encode( $filename [, $language ] )

Encodes $filename using RFC 2231 / RFC 5987 if it contains non-ASCII characters or RFC 2045 special characters (such as commas). Returns the encoded string UTF-8'lang'percent-encoded, or undef if no encoding was necessary.

_filename_decode( $value )

Decodes an RFC 2231 encoded filename value. In list context returns ( $decoded, $charset, $language ). In scalar context returns just the decoded filename. If decoding is not required the original value is returned unchanged.

_hv

Sets or gets the underlying Module::Generic::HeaderValue object.

_hv_as_string

Returns the stringified form of the Module::Generic::HeaderValue object, or an empty string if none is set.

_new_hv( $string )

Instantiates a new Module::Generic::HeaderValue from $string.

_parse_header_value( $string )

Parses $string as a structured header value using "new_from_header" in Module::Generic::HeaderValue and returns the resulting object.

_set_get_param( $name [, $value ] )

Low-level parameter accessor, delegates to the internal Module::Generic::HeaderValue object.

_set_get_params( $name => $value, ... )

Low-level multi-parameter accessor.

_set_get_qparam( $name [, $value ] )

Like "_set_get_param" but stores the value surrounded by double quotes and strips them on retrieval. Used for filename= parameters.

_set_get_value( [ $value ] )

Low-level main-value accessor.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Mail::Make, Mail::Make::Headers, Mail::Make::Headers::ContentType, Mail::Make::Headers::ContentDisposition

COPYRIGHT & LICENSE

Copyright(c) 2026 DEGUEST Pte. Ltd.

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.