Skip Menu |

This queue is for tickets about the MooseX-Storage CPAN distribution.

Report information
The Basics
Id: 76913
Status: resolved
Priority: 0/
Queue: MooseX-Storage

People
Owner: Nobody in particular
Requestors: DAVEGMX [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Im not sure if this is a bug, though its currently preventing me from using MooseX::Storage in a project, and I really want to. I am calling freeze on a moose object of type ABC that implements a role DEF with a lazy built attribute, call it xyz, of type XYZ. Both ABC and XYZ use MooseX::Storage and are with Storage(format => 'JSON'); But I am not able to serialize them then print Dumper( $abc->freeze ) encountered object 'XYZ=HASH(0x7f971954fcb8)', but neither allow_blessed nor convert_blessed settings are enabled at /Users/mobiusinversion/perl5/lib/perl5/JSON/Any.pm line 510. A fully working example with a test suite is attached. It appears the issue is MooseX::Storage wants to inspect the attributes of an implemented role with a lazy build but then is not able to see that the lazy built object also implements the JSON role.
Subject: Example.tar.gz
Download Example.tar.gz
application/x-gzip 935b

Message body not shown because it is not plain text.

Hey guys, anyone reading this?
Hey guys, anyone reading this?
This is due to the fact that the packer in MooseX::Storage is type based. The '__glue__' attribute in your example is not being packed as it doesn't have an 'isa' declaration in the attribute. If you add isa => 'MyApp::Glue::XZY' at the appropriate point, I think everything will behave as you expect. I'd love a patch to clarify the docs about this, if you'd be willing? :)