Revision history for MooseX-Storage
* Fix URI for repository in metadata.
+ * Fix infinite recursion when collapsing objects which overload stringify
+ to freeze themselves.
0.25
* Add support for Union types (bumps Moose dep to 0.99)
author_tests 't/author';
-build_requires 'Test::More' => '0.42';
+build_requires 'Test::More' => '0.88';
build_requires 'Test::Deep' => '0';
build_requires 'Test::Exception' => '0';
build_requires 'Test::TempDir' => '0.02';
default => sub {{}}
);
-has 'object' => (is => 'rw', isa => 'Object');
+has 'object' => (is => 'rw', isa => 'Object', predicate => '_has_object');
has 'class' => (is => 'rw', isa => 'Str');
## this is the API used by other modules ...
} grep {
# Skip our special skip attribute :)
!$_->does('MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize')
- } ($self->object || $self->class)->meta->get_all_attributes;
+ } ($self->_has_object ? $self->object : $self->class)->meta->get_all_attributes;
}
## ------------------------------------------------------------------
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+
+BEGIN {
+ eval { require JSON::Any } or do {
+ plan skip_all => "JSON::Any is required for this test";
+ exit 0;
+ }
+}
+
+{
+ package Thing;
+ use Moose;
+ use MooseX::Storage;
+
+ use overload
+ q{""} => 'as_string',
+ fallback => 1;
+
+ with Storage('format' => 'JSON');
+
+ has foo => ( is => 'ro' );
+
+ sub as_string { shift->freeze }
+
+ no Moose;
+}
+
+my $i = Thing->new(foo => "bar");
+
+lives_ok {
+ $i . "";
+} 'Can stringify without deep recursion';
+
+done_testing;
+