Stanisław Klekot > Log-Message-JSON-0.30.01 > Log::Message::JSON::Hash

Download:
Log-Message-JSON-0.30.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Log::Message::JSON::Hash - Tie::IxHash(3) wrapper supporting storing cache

SYNOPSIS ^

  use Log::Message::JSON::Hash;
  use JSON;

  tie my %hash, "Log::Message::JSON::Hash";
  # fill %hash...
  tied(%hash)->cache = encode_json(\%hash);

  # ...

  print tied(%hash)->cache;

DESCRIPTION ^

This class is a proxy to Tie::IxHash(3). It's a valid class to tie hash to, and above this the class adds possibility of storing a cache.

The cache is cleared on every destructive operation (storing an element, deleting an element and clearing whole hash).

API ^

Own Methods

new()

Constructor.

cache()
cache($data)

Get or set cache for this object.

Cache will be cleared on any destructive operation performed on this object.

Methods Satisfying tie() API

All the rest of methods are defined to satisfy API for tie() function. They call appropriate methods of underlying Tie::IxHash(3) object.

AUTHOR ^

Stanislaw Klekot, <cpan at jarowit.net>

LICENSE AND COPYRIGHT ^

Copyright 2013 Stanislaw Klekot.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO ^

Tie::IxHash(3), Tie::Hash(3), tie() in perlfunc(1)

syntax highlighting: