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. πŸ’œ


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