moving MooseX::Storage
[gitmo/MooseX-Storage.git] / lib / MooseX / Storage / Format / JSON.pm
1
2 package MooseX::Storage::Format::JSON;
3 use Moose::Role;
4
5 use JSON::Any;
6
7 requires 'pack';
8 requires 'unpack';
9
10 sub thaw {
11     my ( $class, $json ) = @_;
12     $class->unpack( JSON::Any->jsonToObj($json) );
13 }
14
15 sub freeze {
16     my $self = shift;
17     JSON::Any->objToJson( $self->pack() );
18 }
19
20 1;
21
22 __END__
23
24 =pod
25
26 =head1 NAME
27
28 MooseX::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
54 All complex software has bugs lurking in it, and this module is no 
55 exception. If you find a bug please either email me, or add the bug
56 to cpan-RT.
57
58 =head1 AUTHOR
59
60 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
61
62 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
63
64 =head1 COPYRIGHT AND LICENSE
65
66 Copyright 2007 by Infinity Interactive, Inc.
67
68 L<http://www.iinteractive.com>
69
70 This library is free software; you can redistribute it and/or modify
71 it under the same terms as Perl itself.
72
73 =cut
74
75