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 package Point;
10 use Moose;
11 use MooseX::Storage;
12
13 with Storage('format' => 'YAML');
14
15 has 'x' => (is => 'rw', isa => 'Int');
16 has 'y' => (is => 'rw', isa => 'Int');
17
18 1;
19
20 my $p = Point->new(x => 10, y => 10);
21
22 ## methods to freeze/thaw into
23 ## a specified serialization format
24 ## (in this case YAML)
25
26 # pack the class into a YAML string
27 $p->freeze();
28
29 # ----
30 # __CLASS__: "Point"
31 # x: 10
32 # y: 10
33
34 # unpack the JSON string into a class
35 my $p2 = Point->thaw(<<YAML);
36 ----
37 __CLASS__: "Point"
38 x: 10
39 y: 10
40 YAML
41
43 freeze
44 thaw ($yaml)
45
46 Introspection
47 meta
48
50 All complex software has bugs lurking in it, and this module is no
51 exception. If you find a bug please either email me, or add the bug to
52 cpan-RT.
53
55 Chris Prather <chris.prather@iinteractive.com>
56
57 Stevan Little <stevan.little@iinteractive.com>
58
60 Copyright 2007-2008 by Infinity Interactive, Inc.
61
62 <http://www.iinteractive.com>
63
64 This library is free software; you can redistribute it and/or modify it
65 under the same terms as Perl itself.
66
67
68
69perl v5.12.0 2009-07-14 MooseX::Storage::Format::YAML(3)