adding metaclass alias
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Format / JSON.pm
CommitLineData
a23e18d7 1
4d1850a6 2package MooseX::Storage::Format::JSON;
a23e18d7 3use Moose::Role;
4
b5384d08 5use JSON::Any;
a23e18d7 6
4d1850a6 7requires 'pack';
8requires 'unpack';
a23e18d7 9
10sub thaw {
11 my ( $class, $json ) = @_;
b5384d08 12 $class->unpack( JSON::Any->jsonToObj($json) );
a23e18d7 13}
14
15sub freeze {
16 my $self = shift;
b5384d08 17 JSON::Any->objToJson( $self->pack() );
a23e18d7 18}
19
201;
21
22__END__
23
24=pod
25
ec9c1923 26=head1 NAME
27
28MooseX::Storage::Format::JSON
29
30=head1 SYNOPSIS
31
32=head1 DESCRIPTION
33
34=head1 METHODS
35
36=over 4
37
38=item B<freeze>
39
40=item B<thaw ($json)>
41
42=back
43
44=head2 Introspection
45
46=over 4
47
48=item B<meta>
49
50=back
51
52=head1 BUGS
53
54All complex software has bugs lurking in it, and this module is no
55exception. If you find a bug please either email me, or add the bug
56to cpan-RT.
57
58=head1 AUTHOR
59
60Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
61
62Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
63
64=head1 COPYRIGHT AND LICENSE
65
66Copyright 2007 by Infinity Interactive, Inc.
67
68L<http://www.iinteractive.com>
69
70This library is free software; you can redistribute it and/or modify
71it under the same terms as Perl itself.
72
a23e18d7 73=cut
74
ec9c1923 75