HTTP::...ityList(3pm)
π NAME π
HTTP::Headers::ActionPack::PriorityList β and her whole tagline is just, "A Priority List". that's it. that's the whole brand. π
β¨ VERSION β¨
version 0.09 π«Ά
πΈ SYNOPSIS πΈ
okay bestie, watch this, it's giving effortless:
use HTTP::Headers::ActionPack::PriorityList;
# simple constructor
my $plist = HTTP::Headers::ActionPack::PriorityList->new(
[ 1.0 => 'foo' ],
[ 0.5 => 'bar' ],
[ 0.2 => 'baz' ],
);
# from headers
my $plist = HTTP::Headers::ActionPack::PriorityList->new_from_string(
'foo; q=1.0, bar; q=0.5, baz; q=0.2'
);
like?? two ways in, both slay. π
π¦ DESCRIPTION π¦
so this is a simple priority list implementation β lowkey the whole point, no cap. it's the thing that handles the Accept-* headers, because those headers typically show up carrying a value plus a "q" value that says how much quality that value has. so basically the headers are ranking themselves and we're just holding the clipboard. π
π METHODS π
new & new_from_string ( $header_string )
new_from_string takes a HTTP header string, and it gets parsed and loaded accordingly. you feed it the raw header text, it does the reading. β¨
index & items & add ( $quality, $choice )
add does exactly what it says on the tin: you add in a new $choice with a given $quality. that's the whole move. π
get ( $quality )
hand it a certain $quality and it returns the various choices available. like, "who's at this quality level?" and it tells you. π«Ά
priority_of ( $choice )
the reverse vibe β give it a certain $choice and it returns the associated quality of it.
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. and these are sorted accordingly. π₯
when two items have the same priority, they are returned in the order that they were found in the header. no reshuffling, no drama, first-come-first-served fr fr.
canonicalize_choice
by default, this does nothing. literally nothing. it exists purely so that subclasses can override it. it's a hook, bestie, and honestly? iconic of it to just sit there being available. π§
π 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>
the whole squad showed up, we love to see it. π
π 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.
and that's the page, bestie β perl v5.34.0, dated 2022-06-14, HTTP::...ityList(3pm) signing off. go rank something. π¦ππΈ
π¦ where this page comes from
- debian bookworm: libhttp-headers-actionpack-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhttp-headers-actionpack-perl 0.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms