From: Stevan Little Date: Fri, 14 Mar 2008 13:25:18 +0000 (+0000) Subject: 0.12 X-Git-Tag: 0.14~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4fa64e865c99a6dcc3bec159a662300151d62fdf;p=gitmo%2FMooseX-Storage.git 0.12 --- diff --git a/Changes b/Changes index 5913927..da624dd 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,22 @@ Revision history for MooseX-Storage -0.12 ??? +0.12 Fri. March 14, 2008 - added build_requires for Test::Deep (awwaiid) + - upped the Moose dependency to support the custom + meta-attribute-traits + + * t/ + - fixing all the tests to properly skip if optional + features are not being used, this should help get + rid of all our CPANtester failures + - tested against 5.10 as well + + * MooseX::Storage::Meta::Attribute::DoNotSerialize + MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize + - adding meta-attribute-trait support for + DoNotSerialize + - added tests for this 0.11 Thurs. Jan. 10, 2008 diff --git a/Makefile.PL b/Makefile.PL index 518e28a..df9f26c 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -6,7 +6,7 @@ name 'MooseX-Storage'; all_from 'lib/MooseX/Storage.pm'; # Specific dependencies -requires 'Moose' => '0.20'; +requires 'Moose' => '0.38'; # you should have at least one # serialization format diff --git a/README b/README index 8710fec..0fe223c 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -MooseX-Storage version 0.10 +MooseX-Storage version 0.12 INSTALLATION @@ -21,7 +21,7 @@ DEPENDENCIES Moose JSON::Any Best (in order to load a YAML file) - IO::Fole + IO::File OPTIONAL DEPENDENCIES diff --git a/lib/MooseX/Storage.pm b/lib/MooseX/Storage.pm index 7e7d30d..05962d6 100644 --- a/lib/MooseX/Storage.pm +++ b/lib/MooseX/Storage.pm @@ -4,7 +4,7 @@ use Moose qw(confess); use MooseX::Storage::Meta::Attribute::DoNotSerialize; -our $VERSION = '0.11'; +our $VERSION = '0.12'; our $AUTHORITY = 'cpan:STEVAN'; sub import { diff --git a/lib/MooseX/Storage/Base/WithChecksum.pm b/lib/MooseX/Storage/Base/WithChecksum.pm index 207f388..795f7cd 100644 --- a/lib/MooseX/Storage/Base/WithChecksum.pm +++ b/lib/MooseX/Storage/Base/WithChecksum.pm @@ -100,7 +100,7 @@ __END__ =head1 NAME -MooseX::Storage::Base::WithChecksum +MooseX::Storage::Base::WithChecksum - A more secure serialization role =head1 DESCRIPTION diff --git a/lib/MooseX/Storage/Format/JSON.pm b/lib/MooseX/Storage/Format/JSON.pm index 01ddc56..edde12a 100644 --- a/lib/MooseX/Storage/Format/JSON.pm +++ b/lib/MooseX/Storage/Format/JSON.pm @@ -34,7 +34,7 @@ __END__ =head1 NAME -MooseX::Storage::Format::JSON +MooseX::Storage::Format::JSON - A JSON serialization role =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/Format/Storable.pm b/lib/MooseX/Storage/Format/Storable.pm index 5289407..453f23d 100644 --- a/lib/MooseX/Storage/Format/Storable.pm +++ b/lib/MooseX/Storage/Format/Storable.pm @@ -28,7 +28,7 @@ __END__ =head1 NAME -MooseX::Storage::Format::Storable +MooseX::Storage::Format::Storable - A Storable serialization role =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/Format/YAML.pm b/lib/MooseX/Storage/Format/YAML.pm index 3cccc52..91d9749 100644 --- a/lib/MooseX/Storage/Format/YAML.pm +++ b/lib/MooseX/Storage/Format/YAML.pm @@ -35,7 +35,7 @@ __END__ =head1 NAME -MooseX::Storage::Format::YAML +MooseX::Storage::Format::YAML - A YAML serialization role =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/IO/AtomicFile.pm b/lib/MooseX/Storage/IO/AtomicFile.pm index f932254..07e558b 100644 --- a/lib/MooseX/Storage/IO/AtomicFile.pm +++ b/lib/MooseX/Storage/IO/AtomicFile.pm @@ -22,7 +22,7 @@ __END__ =head1 NAME -MooseX::Storage::IO::AtomicFile +MooseX::Storage::IO::AtomicFile - An Atomic File I/O role =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/IO/File.pm b/lib/MooseX/Storage/IO/File.pm index 0bf379f..4cb0e00 100644 --- a/lib/MooseX/Storage/IO/File.pm +++ b/lib/MooseX/Storage/IO/File.pm @@ -28,7 +28,7 @@ __END__ =head1 NAME -MooseX::Storage::IO::File +MooseX::Storage::IO::File - A basic File I/O role =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/IO/StorableFile.pm b/lib/MooseX/Storage/IO/StorableFile.pm index 7688d0c..ab32bf2 100644 --- a/lib/MooseX/Storage/IO/StorableFile.pm +++ b/lib/MooseX/Storage/IO/StorableFile.pm @@ -36,7 +36,7 @@ __END__ =head1 NAME -MooseX::Storage::IO::StorableFile +MooseX::Storage::IO::StorableFile - An Storable File I/O role =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm b/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm index 298935c..8ae691b 100644 --- a/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm +++ b/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm @@ -2,10 +2,11 @@ package MooseX::Storage::Meta::Attribute::DoNotSerialize; use Moose; -our $VERSION = '0.01'; +our $VERSION = '0.02'; our $AUTHORITY = 'cpan:STEVAN'; extends 'Moose::Meta::Attribute'; + with 'MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize'; # register this alias ... package Moose::Meta::Attribute::Custom::DoNotSerialize; @@ -23,7 +24,7 @@ __END__ =head1 NAME -MooseX::Storage::Meta::Attribute::DoNotSerialize +MooseX::Storage::Meta::Attribute::DoNotSerialize - A custom meta-attribute to bypass serialization =head1 SYNOPSIS diff --git a/lib/MooseX/Storage/Meta/Attribute/Trait/DoNotSerialize.pm b/lib/MooseX/Storage/Meta/Attribute/Trait/DoNotSerialize.pm new file mode 100644 index 0000000..f16ab79 --- /dev/null +++ b/lib/MooseX/Storage/Meta/Attribute/Trait/DoNotSerialize.pm @@ -0,0 +1,81 @@ + +package MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize; +use Moose::Role; + +our $VERSION = '0.01'; +our $AUTHORITY = 'cpan:STEVAN'; + +# register this alias ... +package Moose::Meta::Attribute::Custom::Trait::DoNotSerialize; + +our $VERSION = '0.01'; +our $AUTHORITY = 'cpan:STEVAN'; + +sub register_implementation { 'MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize' } + +1; + +__END__ + +=pod + +=head1 NAME + +MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize - A custom meta-attribute-trait to bypass serialization + +=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' => ( + traits => [ '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-trait. See the SYNOPSIS for a nice +example that can be easily cargo-culted. + +=head1 METHODS + +=head2 Introspection + +=over 4 + +=item B + +=back + +=head1 BUGS + +All complex software has bugs lurking in it, and this module is no +exception. If you find a bug please either email me, or add the bug +to cpan-RT. + +=head1 AUTHOR + +Stevan Little Estevan.little@iinteractive.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2007-2008 by Infinity Interactive, Inc. + +L + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/t/002_basic_io.t b/t/002_basic_io.t index 4474eb6..971261b 100644 --- a/t/002_basic_io.t +++ b/t/002_basic_io.t @@ -3,7 +3,14 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More; + +BEGIN { + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; + plan tests => 10; + use_ok('MooseX::Storage'); +} { package Foo; diff --git a/t/008_do_not_serialize.t b/t/008_do_not_serialize.t new file mode 100644 index 0000000..b9d4bd5 --- /dev/null +++ b/t/008_do_not_serialize.t @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More no_plan => 1; +use Test::Exception; + +BEGIN { + use_ok('MooseX::Storage'); +} + +{ + package Foo; + use Moose; + use MooseX::Storage; + + with Storage; + + has 'bar' => ( + metaclass => 'DoNotSerialize', + is => 'rw', + default => sub { 'BAR' } + ); + + has 'baz' => ( + traits => [ 'DoNotSerialize' ], + is => 'rw', + default => sub { 'BAZ' } + ); + + has 'gorch' => ( + is => 'rw', + default => sub { 'GORCH' } + ); + + 1; +} + +my $foo = Foo->new; +isa_ok($foo, 'Foo'); + + diff --git a/t/010_basic_json.t b/t/010_basic_json.t index b589ece..db190fc 100644 --- a/t/010_basic_json.t +++ b/t/010_basic_json.t @@ -8,6 +8,8 @@ use Test::More; BEGIN { eval "use Test::JSON"; plan skip_all => "Test::JSON is required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; plan tests => 12; use_ok('MooseX::Storage'); } diff --git a/t/011_basic_json_w_utf8.t b/t/011_basic_json_w_utf8.t index bcec79b..346325e 100644 --- a/t/011_basic_json_w_utf8.t +++ b/t/011_basic_json_w_utf8.t @@ -7,7 +7,9 @@ use Test::More; BEGIN { eval "use Encode"; - plan skip_all => "Encode is required for this test" if $@; + plan skip_all => "Encode is required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; # NOTE: # this is because JSON::XS is # the only one which really gets diff --git a/t/020_basic_yaml.t b/t/020_basic_yaml.t index 826e663..ae26092 100644 --- a/t/020_basic_yaml.t +++ b/t/020_basic_yaml.t @@ -7,7 +7,7 @@ use Test::More; BEGIN { eval "use Test::YAML::Valid"; - plan skip_all => "Test::YAML::Valid is required for this test" if $@; + plan skip_all => "Test::YAML::Valid is required for this test" if $@; plan tests => 12; use_ok('MooseX::Storage'); } diff --git a/t/030_with_checksum.t b/t/030_with_checksum.t index 598e22c..9892500 100644 --- a/t/030_with_checksum.t +++ b/t/030_with_checksum.t @@ -9,7 +9,9 @@ use Test::Deep; BEGIN { eval "use Digest; use Digest::SHA1"; - plan skip_all => "Digest and Digest::SHA1 is required for this test" if $@; + plan skip_all => "Digest and Digest::SHA1 is required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; plan tests => 26; use_ok('MooseX::Storage'); } diff --git a/t/060_basic_deferred.t b/t/060_basic_deferred.t index cec3ab3..9be9b3a 100644 --- a/t/060_basic_deferred.t +++ b/t/060_basic_deferred.t @@ -1,4 +1,5 @@ #!/usr/bin/perl + $|++; use strict; use warnings; @@ -8,7 +9,9 @@ use Storable; BEGIN { eval "use Test::JSON; use Test::YAML::Valid;"; - plan skip_all => "Test::JSON and Test::YAML::Valid are required for this test" if $@; + plan skip_all => "Test::JSON and Test::YAML::Valid are required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; plan tests => 33; use_ok('MooseX::Storage'); } diff --git a/t/061_basic_deferred_w_io.t b/t/061_basic_deferred_w_io.t index 3cc66af..55f215a 100644 --- a/t/061_basic_deferred_w_io.t +++ b/t/061_basic_deferred_w_io.t @@ -7,7 +7,9 @@ use Test::More; BEGIN { eval "use IO::AtomicFile"; - plan skip_all => "IO::AtomicFile is required for this test" if $@; + plan skip_all => "IO::AtomicFile is required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; plan tests => 21; use_ok('MooseX::Storage'); } diff --git a/t/100_io.t b/t/100_io.t index b494e10..fc5d0f5 100644 --- a/t/100_io.t +++ b/t/100_io.t @@ -3,9 +3,12 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More; -BEGIN { +BEGIN { + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; + plan tests => 10; use_ok('MooseX::Storage'); } diff --git a/t/101_io_atomic.t b/t/101_io_atomic.t index 20e0aa5..6d52cbf 100644 --- a/t/101_io_atomic.t +++ b/t/101_io_atomic.t @@ -7,7 +7,9 @@ use Test::More; BEGIN { eval "use IO::AtomicFile"; - plan skip_all => "IO::AtomicFile is required for this test" if $@; + plan skip_all => "IO::AtomicFile is required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; plan tests => 10; use_ok('MooseX::Storage'); } diff --git a/t/104_io_w_utf8.t b/t/104_io_w_utf8.t index 39753ad..fb71523 100644 --- a/t/104_io_w_utf8.t +++ b/t/104_io_w_utf8.t @@ -6,6 +6,8 @@ use warnings; use Test::More; BEGIN { + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; # NOTE: # this is because JSON::XS is # the only one which really gets diff --git a/t/105_io_atomic_w_utf8.t b/t/105_io_atomic_w_utf8.t index 8c19f5d..6da8d3e 100644 --- a/t/105_io_atomic_w_utf8.t +++ b/t/105_io_atomic_w_utf8.t @@ -7,7 +7,9 @@ use Test::More; BEGIN { eval "use IO::AtomicFile"; - plan skip_all => "IO::AtomicFile is required for this test" if $@; + plan skip_all => "IO::AtomicFile is required for this test" if $@; + eval "use JSON::Any"; + plan skip_all => "JSON::Any is required for this test" if $@; # NOTE: # this is because JSON::XS is # the only one which really gets