NAME

Keystone::Resolver::Utils - Simple utility functions for Keystone Resolver

SYNOPSIS

use Keystone::Resolver::Utils qw(encode_hash decode_hash);
$string = encode_hash(%foo);
%bar = decode_hash($string);

DESCRIPTION

This module consists of standalone functions -- yes, that's right, functions: not classes, not methods, functions. These are provided for the use of Keystone Resolver.

FUNCTIONS

encode_hash(), decode_hash()

$string = encode_hash(%foo);
%bar = decode_hash($string);

encode_hash() encodes a hash into a single scalar string, which may then be stored in a database, specified as a URL parameters, etc. decode_hash() decodes a string created by encode_hash() back into a hash identical to the original.

These two functions constitute a tiny subset of the functionality of the Storable module, but have the pleasant property that the encoded form is human-readable and therefore useful in logging. In theory, the encoding is secret, but I may as well admit that the hash is encoded as a URL query.

utf8param()

$unicodeString = utf8param($r, $key)

Returns the value associated with the parameter named $key in the Apache Request (or similar object) $r, on the assumption that the encoded value was a sequence of UTF-8 octets. These octets are decoded into Unicode characters, and it is a string of these that is returned.