Stevan Little

NAME

Data::Phrasebook::Loader::JSON::Syck - A Data::Phrasebook loader for JSON files

SYNOPSIS

  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'});

DESCRIPTION

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.

EXPECTED JSON FORMAT

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.

  {
      foo: "Welcome to [% my %] world. It is a nice [%place %].",
      bar: "Welcome to :my world. It is a nice :place."
  }

CAVEATS

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.

WHY JSON?

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.

METHODS

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.

load ($filename)
get ($key)

SEE ALSO

Data::Phrasebook
JSON::Syck
http://www.json.org/

BUGS

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.

AUTHOR

Stevan Little <stevan@iinteractive.com>

COPYRIGHT AND LICENSE

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.




Hosting generously
sponsored by Bytemark