1 package MooseX::Storage::Format::YAML;
4 # When I add YAML::LibYAML
5 # Tests break because tye YAML is invalid...?
8 use YAML::Any qw(Load Dump);
14 my ( $class, $yaml, @args ) = @_;
15 $class->unpack( Load($yaml), @args );
19 my ( $self, @args ) = @_;
20 Dump( $self->pack(@args) );
33 MooseX::Storage::Format::YAML - A YAML serialization role
41 with Storage('format' => 'YAML');
43 has 'x' => (is => 'rw', isa => 'Int');
44 has 'y' => (is => 'rw', isa => 'Int');
48 my $p = Point->new(x => 10, y => 10);
50 ## methods to freeze/thaw into
51 ## a specified serialization format
52 ## (in this case YAML)
54 # pack the class into a YAML string
62 # unpack the JSON string into a class
63 my $p2 = Point->thaw(<<YAML);
90 All complex software has bugs lurking in it, and this module is no
91 exception. If you find a bug please either email me, or add the bug
96 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
98 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
100 =head1 COPYRIGHT AND LICENSE
102 Copyright 2007-2008 by Infinity Interactive, Inc.
104 L<http://www.iinteractive.com>
106 This library is free software; you can redistribute it and/or modify
107 it under the same terms as Perl itself.