File::DataClass::Storage::JSON - Read/write JSON data storage model
use Moo; extends 'File::DataClass::Schema'; has '+storage_class' => default => 'JSON';
Uses JSON::MaybeXS to read and write JSON files
Defines the following attributes;
extn
The extension appended to filenames. Defaults to .json
read_options
This hash reference is used to customise the JSON decoder object used when reading the file. It defaults to reboolify false (causes booleans to be inflated to objects) and utf8 false (the io object does the encoding). This filter would cause the data to be untainted (running suid). I shit you not
reboolify
utf8
suid
filter_json_object => sub { $_[ 0 ] }
write_options
This hash reference is used to customise the JSON encoder object used when writing the file. It defaults to canonical true (sorts the keys in the hashes), convert_blessed true (looks for and uses the TO_JSON method), pretty true (uses whitespace for indentation), and utf8 false (the io object does the encoding)
canonical
convert_blessed
TO_JSON
pretty
API required method. Calls "decode" in JSON::MaybeXS to parse the input
API required method. Calls "encode" in JSON::MaybeXS to generate the output
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Using the module JSON::XS causes the round trip test to fail
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2017 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install File::DataClass, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::DataClass
CPAN shell
perl -MCPAN -e shell install File::DataClass
For more information on module installation, please visit the detailed CPAN module installation guide.