logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Api

       This class supports the following methods:

Author

       Dave Rolsky <autarch@urth.org>

Courriel::Headerattribute->New( ... )

       This method creates a new object. It accepts the following parameters:

       •   name

           The name of the attribute. This should be a non-empty string.

       •   value

           The value of the attribute. This can be empty.

       •   charset

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

       •   language

           The language for the attribute's value. It should be a valid ISO language code like "en-us" or  "zh".
           This is optional.

   $attribute->name()
       The attribute name as passed to the constructor.

   $attribute->value()
       The attribute value as passed to the constructor.

   $attribute->charset()
       The attribute's charset.

   $attribute->language()
       The attribute's language.

   $attribute->as_string()
       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.

Description

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

Name

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

Roles

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

Source

       The source code repository for Courriel can be found at <https://github.com/houseabsolute/Courriel>.

Support

       Bugs may be submitted at <https://github.com/houseabsolute/Courriel/issues>.

       I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".

Synopsis

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

Version

       version 0.49

See Also