1MooseX::Storage::FormatU:s:eJrSOCNo(n3t)ributed Perl DocMuomoesnetXa:t:iSotnorage::Format::JSON(3)
2
3
4
6 MooseX::Storage::Format::JSON - A JSON serialization role
7
9 version 0.53
10
12 package Point;
13 use Moose;
14 use MooseX::Storage;
15
16 with Storage('format' => 'JSON');
17
18 has 'x' => (is => 'rw', isa => 'Int');
19 has 'y' => (is => 'rw', isa => 'Int');
20
21 1;
22
23 my $p = Point->new(x => 10, y => 10);
24
25 ## methods to freeze/thaw into
26 ## a specified serialization format
27 ## (in this case JSON)
28
29 # pack the class into a JSON string
30 $p->freeze(); # { "__CLASS__" : "Point", "x" : 10, "y" : 10 }
31
32 # unpack the JSON string into a class
33 my $p2 = Point->thaw('{ "__CLASS__" : "Point", "x" : 10, "y" : 10 }');
34
36 freeze
37 thaw ($json)
38
40 Bugs may be submitted through the RT bug tracker
41 <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage> (or
42 bug-MooseX-Storage@rt.cpan.org <mailto:bug-MooseX-
43 Storage@rt.cpan.org>).
44
45 There is also a mailing list available for users of this distribution,
46 at <http://lists.perl.org/list/moose.html>.
47
48 There is also an irc channel available for users of this distribution,
49 at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
50
52 · Chris Prather <chris.prather@iinteractive.com>
53
54 · Stevan Little <stevan.little@iinteractive.com>
55
56 · יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
57
59 This software is copyright (c) 2007 by Infinity Interactive, Inc.
60
61 This is free software; you can redistribute it and/or modify it under
62 the same terms as the Perl 5 programming language system itself.
63
64
65
66perl v5.32.0 2020-07-28 MooseX::Storage::Format::JSON(3)