Acme::MooseX::JSON - Moose objects that are internally blessed scalar refs containing JSON
{ package Local::Person; use Acme::MooseX::JSON; has name => (is => 'rw', isa => 'Str'); } my $object = Local::Person->new(name => "Bob"); print $$object; # JSON
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.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Scalar-Accessors-LikeHash.
Scalar::Accessors::LikeHash, JSON, Moose.
MooseX::InsideOut, MooseX::GlobRef, MooseX::ArrayRef.
Toby Inkster <tobyink@cpan.org>.
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.
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.
To install Scalar::Accessors::LikeHash, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Scalar::Accessors::LikeHash
CPAN shell
perl -MCPAN -e shell install Scalar::Accessors::LikeHash
For more information on module installation, please visit the detailed CPAN module installation guide.