18 Jun 2013 18:56:53 UTC
- Distribution: HTTP-Headers-ActionPack
- Module version: 0.09
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (6793 / 51 / 0)
- KwaliteeBus factor: 1
- 91.04% Coverage
- License: perl_5
- Activity24 month
- Download (35.27KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:DROLSKY Dave Rolsky
HTTP::Headers::ActionPack::PriorityList - A Priority List
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' );
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.
new_from_string ( $header_string )
This accepts a HTTP header string which get parsed and loaded accordingly.
add ( $quality, $choice )
Add in a new
$choicewith a given
get ( $quality )
Given a certain
$quality, it returns the various choices available.
priority_of ( $choice )
Given a certain
$choicethis returns the associated quality of it.
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.
When two items have the same priority, they are returned in the order that they were found in the header.
By default, this does nothing. It exists so that subclasses can override it.
Stevan Little <firstname.lastname@example.org>
Andrew Nelson <email@example.com>
Dave Rolsky <firstname.lastname@example.org>
Florian Ragwitz <email@example.com>
Jesse Luehrs <firstname.lastname@example.org>
Karen Etheridge <email@example.com>
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.
Module Install Instructions
To install HTTP::Headers::ActionPack, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install HTTP::Headers::ActionPack
For more information on module installation, please visit the detailed CPAN module installation guide.