From: Stevan Little Date: Mon, 30 Apr 2007 00:09:03 +0000 (+0000) Subject: foo X-Git-Tag: 0_02~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b477f392a4f593b3a02da32676b960522ace530f;p=gitmo%2FMooseX-Storage.git foo --- diff --git a/lib/MooseX/Storage/Engine/IO/AtomicFile.pm b/lib/MooseX/Storage/Engine/IO/AtomicFile.pm index a75c71d..41535e7 100644 --- a/lib/MooseX/Storage/Engine/IO/AtomicFile.pm +++ b/lib/MooseX/Storage/Engine/IO/AtomicFile.pm @@ -22,12 +22,12 @@ __END__ =head1 NAME -MooseX::Storage::Engine::IO::AtomicFile - -=head1 SYNOPSIS +MooseX::Storage::Engine::IO::AtomicFile - The actually atomic file storage mechanism. =head1 DESCRIPTION +This provides the actual means to store data to a file atomically. + =head1 METHODS =over 4 diff --git a/lib/MooseX/Storage/Engine/IO/File.pm b/lib/MooseX/Storage/Engine/IO/File.pm index da5e0f4..ee27c3f 100644 --- a/lib/MooseX/Storage/Engine/IO/File.pm +++ b/lib/MooseX/Storage/Engine/IO/File.pm @@ -30,12 +30,12 @@ __END__ =head1 NAME -MooseX::Storage::Engine::IO::File - -=head1 SYNOPSIS +MooseX::Storage::Engine::IO::File - The actually file storage mechanism. =head1 DESCRIPTION +This provides the actual means to store data to a file. + =head1 METHODS =over 4 diff --git a/lib/MooseX/Storage/Format/JSON.pm b/lib/MooseX/Storage/Format/JSON.pm index cc5544a..713dfa7 100644 --- a/lib/MooseX/Storage/Format/JSON.pm +++ b/lib/MooseX/Storage/Format/JSON.pm @@ -52,8 +52,6 @@ MooseX::Storage::Format::JSON # unpack the JSON string into a class my $p2 = Point->thaw('{ "__CLASS__" : "Point", "x" : 10, "y" : 10 }'); -=head1 DESCRIPTION - =head1 METHODS =over 4 diff --git a/lib/MooseX/Storage/Format/YAML.pm b/lib/MooseX/Storage/Format/YAML.pm index d7ccb06..df4d0a1 100644 --- a/lib/MooseX/Storage/Format/YAML.pm +++ b/lib/MooseX/Storage/Format/YAML.pm @@ -64,8 +64,6 @@ MooseX::Storage::Format::YAML x: 10 y: 10 YAML - -=head1 DESCRIPTION =head1 METHODS diff --git a/lib/MooseX/Storage/IO/AtomicFile.pm b/lib/MooseX/Storage/IO/AtomicFile.pm index 8d29e18..ebc84f0 100644 --- a/lib/MooseX/Storage/IO/AtomicFile.pm +++ b/lib/MooseX/Storage/IO/AtomicFile.pm @@ -23,7 +23,25 @@ MooseX::Storage::IO::AtomicFile =head1 SYNOPSIS -=head1 DESCRIPTION + package Point; + use Moose; + use MooseX::Storage; + + with Storage('format' => 'JSON', 'io' => 'AtomicFile'); + + has 'x' => (is => 'rw', isa => 'Int'); + has 'y' => (is => 'rw', isa => 'Int'); + + 1; + + my $p = Point->new(x => 10, y => 10); + + ## methods to load/store a class + ## on the file system + + $p->store('my_point.json'); + + my $p2 = Point->load('my_point.json'); =head1 METHODS diff --git a/lib/MooseX/Storage/IO/File.pm b/lib/MooseX/Storage/IO/File.pm index f8da86c..981946d 100644 --- a/lib/MooseX/Storage/IO/File.pm +++ b/lib/MooseX/Storage/IO/File.pm @@ -29,7 +29,25 @@ MooseX::Storage::IO::File =head1 SYNOPSIS -=head1 DESCRIPTION + package Point; + use Moose; + use MooseX::Storage; + + with Storage('format' => 'JSON', 'io' => 'File'); + + has 'x' => (is => 'rw', isa => 'Int'); + has 'y' => (is => 'rw', isa => 'Int'); + + 1; + + my $p = Point->new(x => 10, y => 10); + + ## methods to load/store a class + ## on the file system + + $p->store('my_point.json'); + + my $p2 = Point->load('my_point.json'); =head1 METHODS diff --git a/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm b/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm index 7856ad5..29e0e57 100644 --- a/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm +++ b/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm @@ -20,8 +20,30 @@ MooseX::Storage::Meta::Attribute::DoNotSerialize =head1 SYNOPSIS + package Point; + use Moose; + use MooseX::Storage; + + with Storage('format' => 'JSON', 'io' => 'File'); + + has 'x' => (is => 'rw', isa => 'Int'); + has 'y' => (is => 'rw', isa => 'Int'); + + has 'foo' => ( + metaclass => 'DoNotSerialize', + is => 'rw', + isa => 'CodeRef', + ); + + 1; + =head1 DESCRIPTION +Sometimes you don't want a particular attribute to be part of the +serialization, in this case, you want to make sure that attribute +uses this custom meta-attribute. See the SYNOPSIS for a nice example +that can be easily cargo-culted. + =head1 METHODS =head2 Introspection