NAME
eris::role::dictionary::hash - Simple dictionary implementation based off a hash
VERSION
version 0.008
SYNOPSIS
Simplest possible dictionary implementation
package my::app::dictionary::business;
use Moo;
with qw(
eris::role::dictionary::hash
);
sub hash {
return {
'customer_id' => "Our customer ID field",
'store_id' => "Our store ID field",
'price_usd' => "Object price in USD",
'transaction_key' => "Transaction Identifier",
}
}
METHODS
lookup($field)
Find the field in the hash, returns a hashref in the format:
{
field => $field,
description => $lookup_hash{$field},
}
Or if the hash value is a hash reference, we return:
{
field => $field,
%{ $lookup_hash{$field} },
}
fields()
Returns the sorted list of keys in the lookup hash
expand_line
Expand a line in a file/DATA section to a workable hash
INTERFACE
hash
Return a HashRef with the field names as keys and a string description of the field.
May also return a HashRef with field names as keys and a HashRef as a value. Those key/value pairs will be returned to the lookup()
function.
SEE ALSO
eris::role::dictionary, eris::dictionary, eris::dictionary::cee
AUTHOR
Brad Lhotsky <brad@divisionbyzero.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2015 by Brad Lhotsky.
This is free software, licensed under:
The (three-clause) BSD License