moose / MooseX-Storage

A serialization framework for Moose classes
http://metacpan.org/release/MooseX-Storage/
Other
6 stars 11 forks source link

patched to handle serialization of undef required params. #6

Closed cowholio4 closed 10 years ago

cowholio4 commented 10 years ago

I had a model with the following attributes and I could not freeze and thaw it without an exception.

has 'string' => ( is => 'ro', required => 1, isa => 'Str | Undef' );

To reproduce you can run the attached test: t/013_basic_json_required_undef.t

The two changes I made are:

It passes all tests.

karenetheridge commented 10 years ago

MooseX-Storage 0.47 contains some changes based on your PR here - please give it a try! The fact that the attribute is required is irrelevant - all that is significant is that the value slot is populated with undef.