NAME
Acme::MooseX::JSON - Moose objects that are internally blessed scalar refs containing JSON
SYNOPSIS
{
package Local::Person;
use Acme::MooseX::JSON;
has name => (is => 'rw', isa => 'Str');
}
my $object = Local::Person->new(name => "Bob");
print $$object; # JSON
DESCRIPTION
This Moose extension is akin to MooseX::InsideOut, MooseX::GlobRef and MooseX::ArrayRef in that it allows you to create Moose classes where the instances aren't blessed hashes.
However, unlike those fine modules, Acme::MooseX::JSON chooses just about the most insane way of implementing an instance's internals possible: they're serialized as a JSON string, which is then used as a blessed scalar reference.
The use of JSON to serialize the object's internals places fairly strong restrictions on what kind of data can be held in the object's attributes. Strings, numbers and undef are all OK; arrayrefs and hashrefs are OK provided you don't create cyclical data structures, and provided they don't contain any non-OK data as values.
This module requires JSON 2.00+ and Moose 2.00+ to be installed.
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Scalar-Accessors-LikeHash.
SEE ALSO
Scalar::Accessors::LikeHash, JSON, Moose.
MooseX::InsideOut, MooseX::GlobRef, MooseX::ArrayRef.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.