NAME

JSON_File - Tie a hash or an array to a JSON

VERSION

version 0.004

SYNOPSIS

use JSON_File;

tie( my %data, 'JSON_File', 'data.json' );

$data{key} = "value"; # data directly stored in file
print $data{key};     # data is always read from file, not cached

$data{hash} = { attribute => "value" };
# DON'T set $data{hash}->{attribute} directly, it will not get saved

tie( my @array, 'JSON_File', 'array.json' );

push @array, "value";

# you can enable functions of the JSON object:

tie( my %other, 'JSON_File', 'other.json',
  pretty => 1,
  allow_unknown => 1,
  allow_blessed => 1,
  convert_blessed => 1,
);

DESCRIPTION

This module is allowing you to bind a perl hash or array to a file. The data is always read directly from the file and also directly written to the file. This means also that if you add several keys to the hash or several elements to the array, that every key and every element will let the complete json file be rewritten.

SUPPORT

IRC

Join #sycontent on irc.perl.org. Highlight Getty for fast reaction :).

Repository

http://github.com/Getty/p5-json_file
Pull request and additional contributors are welcome

Issue Tracker

http://github.com/Getty/p5-json_file/issues

AUTHOR

Torsten Raudssus <torsten@raudss.us>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.