Data::Phrasebook::Loader::JSON::Syck - A Data::Phrasebook loader for JSON files
my $p = Data::Phrasebook->new( class => 'Plain', loader => 'JSON::Syck', file => 'errors.json', ); # now use the phrasebook like any other ... warn $p->fetch('FAILED_LOGIN', { message => 'Could not find user'});
This is a Data::Phrasebook loader which will load phasebooks stored in JSON. It uses the very nice and very fast JSON::Syck parser to load the JSON data.
You should refer to the Data::Phrasebook documentation for more information on how to use this module.
This module expects that the JSON returned from JSON::Syck::Load($json) will be a HASH reference. This is fairly simple as long as your top level data structure is a JSON hash. Here is an example from the test suite.
JSON::Syck::Load($json)
{ foo: "Welcome to [% my %] world. It is a nice [%place %].", bar: "Welcome to :my world. It is a nice :place." }
This phrasebook loader does not yet support multiple phrasebook dictionaries. Future plans do include supporting these, and we will retain backwards compatability with the JSON file format.
Because it is Plain Ole Javascript. If you need to share your phrasebook data (error messages and such) with Javascript, this is the ideal format.
These methods are those required by Data::Phrasebook::Loader, they do not represent the API to this module. Please refer to the Data::Phrasebook for that information.
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
Stevan Little <stevan@iinteractive.com>
Copyright 2006 by Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Data::Phrasebook::Loader::JSON::Syck, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Phrasebook::Loader::JSON::Syck
CPAN shell
perl -MCPAN -e shell install Data::Phrasebook::Loader::JSON::Syck
For more information on module installation, please visit the detailed CPAN module installation guide.