.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTTP::Headers::ActionPack::PriorityList 3pm" .TH HTTP::Headers::ActionPack::PriorityList 3pm 2024-03-06 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME HTTP::Headers::ActionPack::PriorityList \- A Priority List .SH VERSION .IX Header "VERSION" version 0.09 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use HTTP::Headers::ActionPack::PriorityList; \& \& # simple constructor \& my $plist = HTTP::Headers::ActionPack::PriorityList\->new( \& [ 1.0 => \*(Aqfoo\*(Aq ], \& [ 0.5 => \*(Aqbar\*(Aq ], \& [ 0.2 => \*(Aqbaz\*(Aq ], \& ); \& \& # from headers \& my $plist = HTTP::Headers::ActionPack::PriorityList\->new_from_string( \& \*(Aqfoo; q=1.0, bar; q=0.5, baz; q=0.2\*(Aq \& ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This is a simple priority list implementation, this is used to handle the Accept\-* headers as they typically will contain values along with a "q" value to indicate quality. .SH METHODS .IX Header "METHODS" .ie n .IP """new""" 4 .el .IP \f(CWnew\fR 4 .IX Item "new" .PD 0 .ie n .IP """new_from_string ( $header_string )""" 4 .el .IP "\f(CWnew_from_string ( $header_string )\fR" 4 .IX Item "new_from_string ( $header_string )" .PD This accepts a HTTP header string which get parsed and loaded accordingly. .ie n .IP """index""" 4 .el .IP \f(CWindex\fR 4 .IX Item "index" .PD 0 .ie n .IP """items""" 4 .el .IP \f(CWitems\fR 4 .IX Item "items" .ie n .IP """add ( $quality, $choice )""" 4 .el .IP "\f(CWadd ( $quality, $choice )\fR" 4 .IX Item "add ( $quality, $choice )" .PD Add in a new \f(CW$choice\fR with a given \f(CW$quality\fR. .ie n .IP """get ( $quality )""" 4 .el .IP "\f(CWget ( $quality )\fR" 4 .IX Item "get ( $quality )" Given a certain \f(CW$quality\fR, it returns the various choices available. .ie n .IP """priority_of ( $choice )""" 4 .el .IP "\f(CWpriority_of ( $choice )\fR" 4 .IX Item "priority_of ( $choice )" Given a certain \f(CW$choice\fR this returns the associated quality of it. .ie n .IP """iterable""" 4 .el .IP \f(CWiterable\fR 4 .IX Item "iterable" This returns a list of two item ARRAY refs with the quality as the first item and the associated choice as the second item. These are sorted accordingly. .Sp When two items have the same priority, they are returned in the order that they were found in the header. .ie n .IP """canonicalize_choice""" 4 .el .IP \f(CWcanonicalize_choice\fR 4 .IX Item "canonicalize_choice" By default, this does nothing. It exists so that subclasses can override it. .SH AUTHOR .IX Header "AUTHOR" Stevan Little .SH CONTRIBUTORS .IX Header "CONTRIBUTORS" .IP \(bu 4 Andrew Nelson .IP \(bu 4 Dave Rolsky .IP \(bu 4 Florian Ragwitz .IP \(bu 4 Jesse Luehrs .IP \(bu 4 Karen Etheridge .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2012 by Infinity Interactive, Inc.. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.