Man pages sections > man3 > Courriel::HeaderAttribute

Courriel::HeaderAttribute - A single attribute belonging to a header

Courriel::HeaderAttribute(3pm) User Contributed Perl Documentation Courriel::HeaderAttribute(3pm)


Courriel::HeaderAttribute - A single attribute belonging to a header


version 0.44


  my $ct = $headers->get('Content-Type');
  print $ct->get_attribute('charset')->value;


This class represents a single attribute belonging to a header. An attribute consists of a name and value, with optional charset and language information.


This class supports the following methods:

Courriel::HeaderAttribute->new( ... )

This method creates a new object. It accepts the following parameters:
The name of the attribute. This should be a non-empty string.
The value of the attribute. This can be empty.
The charset for the value. If the value contains any non-ASCII data, this will always be "UTF-8", otherwise the default is "us-ascii".
The language for the attribute's value. It should be a valid ISO language code like "en-us" or "zh". This is optional.


The attribute name as passed to the constructor.


The attribute value as passed to the constructor.


The attribute's charset.


The attribute's language.


This returns the attribute in a form suitable for putting in an email. This may involve escaping, quoting, splitting up, and otherwise messing with the value.
If the value needs to be split across continuations, each name/value pair is returned separate by a space, but not folded across multiple lines.

$attribute->stream_to( output => $output )

This method will send the stringified attribute 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.


This class does the "Courriel::Role::Streams" role.


Bugs may be submitted through the RT bug tracker <> (or <>).
I am also usually active on IRC as 'autarch' on "irc://".


Dave Rolsky <> This software is Copyright (c) 2016 by Dave Rolsky.
This is free software, licensed under:
  The Artistic License 2.0 (GPL Compatible)
2016-12-28 perl v5.24.1