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);
10 our $VERSION = '0.34';
11 our $AUTHORITY = 'cpan:STEVAN';
17 my ( $class, $yaml, @args ) = @_;
18 $class->unpack( Load($yaml), @args );
22 my ( $self, @args ) = @_;
23 Dump( $self->pack(@args) );
36 MooseX::Storage::Format::YAML - A YAML serialization role
44 with Storage('format' => 'YAML');
46 has 'x' => (is => 'rw', isa => 'Int');
47 has 'y' => (is => 'rw', isa => 'Int');
51 my $p = Point->new(x => 10, y => 10);
53 ## methods to freeze/thaw into
54 ## a specified serialization format
55 ## (in this case YAML)
57 # pack the class into a YAML string
65 # unpack the JSON string into a class
66 my $p2 = Point->thaw(<<YAML);
93 All complex software has bugs lurking in it, and this module is no
94 exception. If you find a bug please either email me, or add the bug
99 Chris Prather E<lt>chris.prather@iinteractive.comE<gt>
101 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
103 =head1 COPYRIGHT AND LICENSE
105 Copyright 2007-2008 by Infinity Interactive, Inc.
107 L<http://www.iinteractive.com>
109 This library is free software; you can redistribute it and/or modify
110 it under the same terms as Perl itself.