X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStorage%2FFormat%2FYAML.pm;h=1109a01db3e7eaf5256a3265ef9cc0f6b4c92f43;hb=ba17e629b59ca9edaf0bdc88548a04c82c63b880;hp=08bc3c40d5d327affc2e5a8e97bae47e3c9c4b1d;hpb=ea1890074d79bfd64aaf3e9c9571c0708f684772;p=gitmo%2FMooseX-Storage.git diff --git a/lib/MooseX/Storage/Format/YAML.pm b/lib/MooseX/Storage/Format/YAML.pm index 08bc3c4..1109a01 100644 --- a/lib/MooseX/Storage/Format/YAML.pm +++ b/lib/MooseX/Storage/Format/YAML.pm @@ -1,4 +1,3 @@ - package MooseX::Storage::Format::YAML; use Moose::Role; @@ -6,12 +5,10 @@ use Moose::Role; # Tests break because tye YAML is invalid...? # -dcp -use Best [ - [ qw[YAML::Syck YAML] ], - [ qw[Load Dump] ] -]; +use YAML qw(Load Dump); -our $VERSION = '0.02'; +our $VERSION = '0.23'; +our $AUTHORITY = 'cpan:STEVAN'; requires 'pack'; requires 'unpack'; @@ -26,6 +23,8 @@ sub freeze { Dump( $self->pack(@args) ); } +no Moose::Role; + 1; __END__ @@ -34,39 +33,39 @@ __END__ =head1 NAME -MooseX::Storage::Format::YAML +MooseX::Storage::Format::YAML - A YAML serialization role =head1 SYNOPSIS package Point; use Moose; use MooseX::Storage; - + with Storage('format' => 'YAML'); - + has 'x' => (is => 'rw', isa => 'Int'); has 'y' => (is => 'rw', isa => 'Int'); - + 1; - + my $p = Point->new(x => 10, y => 10); - - ## methods to freeze/thaw into + + ## methods to freeze/thaw into ## a specified serialization format ## (in this case YAML) - + # pack the class into a YAML string - $p->freeze(); + $p->freeze(); # ---- - # __CLASS__: "Point" + # __CLASS__: "Point" # x: 10 - # y: 10 - + # y: 10 + # unpack the JSON string into a class - my $p2 = Point->thaw(<thaw(<stevan.little@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2007 by Infinity Interactive, Inc. +Copyright 2007-2008 by Infinity Interactive, Inc. L