Provided by: libhttp-headers-actionpack-perl_0.09-1_all bug

NAME

       HTTP::Headers::ActionPack::ContentNegotiation - A class to handle content negotiation

VERSION

       version 0.09

SYNOPSIS

         use HTTP::Headers::ActionPack;

         my $n = HTTP::Headers::ActionPack->new->get_content_negotiator;

         # matches text/html; charset="iso8859-1"
         $n->choose_media_type(
             ["text/html", "text/html;charset=iso8859-1" ],
             "text/html;charset=iso8859-1, application/xml"
         );

         # matches en-US
         $n->choose_language(
             ['en-US', 'es'],
             "da, en-gb;q=0.8, en;q=0.7"
         );

         # matches US-ASCII
         $n->choose_charset(
             [ "UTF-8", "US-ASCII" ],
             "US-ASCII, UTF-8"
         );

         # matches gzip
         $n->choose_encoding(
             [ "gzip", "identity" },
             "gzip, identity;q=0.7"
         );

DESCRIPTION

       This class provides a set of methods used for content negotiation. It makes full use of
       all the header objects, such as HTTP::Headers::ActionPack::MediaType,
       HTTP::Headers::ActionPack::MediaTypeList and HTTP::Headers::ActionPack::PriorityList.

       Content negotiation is a tricky business, it needs to account for such things as the
       quality rating, order of elements (both in the header and in the list of provided items)
       and in the case of media types it gets even messier. This module does it's best to figure
       things out and do what is expected on it. We have included a number of examples from the
       RFC documents in our test suite as well.

METHODS

       "choose_media_type ( $provided, $header )"
           Given an ARRAY ref of media type strings and an HTTP header, this will return the
           appropriately matching HTTP::Headers::ActionPack::MediaType instance.

       "choose_language ( $provided, $header )"
           Given a list of language codes and an HTTP header value, this will attempt to
           negotiate the best language match. It will return the language string that best
           matched.

       "choose_charset ( $provided, $header )"
           Given a list of charset names and an HTTP header value, this will attempt to negotiate
           the best charset match. It will return the name of the charset that best matched.

       "choose_encoding ( $provided, $header )"
           Given a list of encoding names and an HTTP header value, this will attempt to
           negotiate the best encoding match. It will return the name of the encoding which best
           matched.

SEE ALSO

       HTTP::Negotiate

       There is nothing wrong with this module, however it attempts to answer all the negotiation
       questions at once, whereas this module allows you to do it one thing at a time.

AUTHOR

       Stevan Little <stevan.little@iinteractive.com>

CONTRIBUTORS

       •   Andrew Nelson <anelson@cpan.org>

       •   Dave Rolsky <autarch@urth.org>

       •   Florian Ragwitz <rafl@debian.org>

       •   Jesse Luehrs <doy@tozt.net>

       •   Karen Etheridge <ether@cpan.org>

COPYRIGHT AND LICENSE

       This software is copyright (c) 2012 by Infinity Interactive, Inc..

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

perl v5.22.1                                201HTTP::Headers::ActionPack::ContentNegotiation(3pm)