From: Stevan Little Date: Fri, 14 Mar 2008 14:55:57 +0000 (+0000) Subject: fixing the traits X-Git-Tag: 0.14~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=04990d7a1d61ecde1238e6fd224b6b23b462d05a;p=gitmo%2FMooseX-Storage.git fixing the traits --- diff --git a/Changes b/Changes index da624dd..c10b400 100644 --- a/Changes +++ b/Changes @@ -12,7 +12,8 @@ Revision history for MooseX-Storage rid of all our CPANtester failures - tested against 5.10 as well - * MooseX::Storage::Meta::Attribute::DoNotSerialize + * MooseX::Storage::Engine + MooseX::Storage::Meta::Attribute::DoNotSerialize MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize - adding meta-attribute-trait support for DoNotSerialize diff --git a/lib/MooseX/Storage/Engine.pm b/lib/MooseX/Storage/Engine.pm index e0c9b1e..999dbb9 100644 --- a/lib/MooseX/Storage/Engine.pm +++ b/lib/MooseX/Storage/Engine.pm @@ -2,7 +2,7 @@ package MooseX::Storage::Engine; use Moose; -our $VERSION = '0.04'; +our $VERSION = '0.05'; our $AUTHORITY = 'cpan:STEVAN'; # the class marker when @@ -135,7 +135,7 @@ sub map_attributes { $self->$method_name($_, @args) } grep { # Skip our special skip attribute :) - !$_->isa('MooseX::Storage::Meta::Attribute::DoNotSerialize') + !$_->does('MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize') } ($self->object || $self->class)->meta->compute_all_applicable_attributes; } diff --git a/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm b/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm index 8ae691b..2981cc3 100644 --- a/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm +++ b/lib/MooseX/Storage/Meta/Attribute/DoNotSerialize.pm @@ -11,7 +11,7 @@ extends 'Moose::Meta::Attribute'; # register this alias ... package Moose::Meta::Attribute::Custom::DoNotSerialize; -our $VERSION = '0.01'; +our $VERSION = '0.02'; our $AUTHORITY = 'cpan:STEVAN'; sub register_implementation { 'MooseX::Storage::Meta::Attribute::DoNotSerialize' } diff --git a/t/008_do_not_serialize.t b/t/008_do_not_serialize.t index b9d4bd5..527bc74 100644 --- a/t/008_do_not_serialize.t +++ b/t/008_do_not_serialize.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More no_plan => 1; +use Test::More no_plan => 6; use Test::Exception; BEGIN { @@ -40,4 +40,19 @@ BEGIN { my $foo = Foo->new; isa_ok($foo, 'Foo'); +is($foo->bar, 'BAR', '... got the value we expected'); +is($foo->baz, 'BAZ', '... got the value we expected'); +is($foo->gorch, 'GORCH', '... got the value we expected'); + +is_deeply( + $foo->pack, + { + __CLASS__ => 'Foo', + gorch => 'GORCH' + }, + '... got the right packed class data' +); + + +