REST-Utils
view release on metacpan or search on metacpan
lib/REST/Utils.pm view on Meta::CPAN
my %params =
map { _strip($_) } map { split /=/msx, $_, 2 } @parts[ 1 .. $#parts ];
my $full_type = _strip( $parts[0] );
# Java URLConnection class sends an Accept header that includes a single
# "*" Turn it into a legal wildcard.
if ( $full_type eq q{*} ) {
$full_type = q{*/*};
}
my ( $type, $subtype ) = split m{/}msx, $full_type;
return _strip($type), _strip($subtype), \%params;
}
=head3 quality($mime_type, $ranges)
Returns the quality 'q' of a MIME type when compared against the
media-ranges in $ranges. For example:
print quality('text/html', 'text/*;q=0.3, text/html;q=0.7, text/html;level
# 0.7
( run in 0.911 second using v1.01-cache-2.11-cpan-5511b514fd6 )