1MooseX::Storage::FormatU:s:eYrAMCLo(n3t)ributed Perl DocMuomoesnetXa:t:iSotnorage::Format::YAML(3)
2
3
4
6 MooseX::Storage::Format::YAML - A YAML serialization role
7
9 version 0.52
10
12 package Point;
13 use Moose;
14 use MooseX::Storage;
15
16 with Storage('format' => 'YAML');
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 YAML)
28
29 # pack the class into a YAML string
30 $p->freeze();
31
32 # ----
33 # __CLASS__: "Point"
34 # x: 10
35 # y: 10
36
37 # unpack the JSON string into a class
38 my $p2 = Point->thaw(<<YAML);
39 ----
40 __CLASS__: "Point"
41 x: 10
42 y: 10
43 YAML
44
46 freeze
47 thaw ($yaml)
48
50 Bugs may be submitted through the RT bug tracker
51 <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Storage> (or
52 bug-MooseX-Storage@rt.cpan.org <mailto:bug-MooseX-
53 Storage@rt.cpan.org>).
54
55 There is also a mailing list available for users of this distribution,
56 at <http://lists.perl.org/list/moose.html>.
57
58 There is also an irc channel available for users of this distribution,
59 at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
60
62 · Chris Prather <chris.prather@iinteractive.com>
63
64 · Stevan Little <stevan.little@iinteractive.com>
65
66 · יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
67
69 This software is copyright (c) 2007 by Infinity Interactive, Inc.
70
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73
74
75
76perl v5.30.1 2020-01-30 MooseX::Storage::Format::YAML(3)