Skip Menu |

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

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

People
Owner: bobtfish [...] bobtfish.net
Requestors: icestar [...] inbox.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.27
Fixed in: (no value)



Subject: The first level of serialization into a Perl HASH reference excludes attributes with undefined value
Hello. I'm trying to pack an Moose object with an attribute, which has specified undefined value into a Perl hash. But in the resulted hash this attribute is not presented. Why? Maybe it's better to check the predicate if an attribute was set and for all attributes which were set create hash keys?
I was under the impression that this was working. Can you provide a failing test case to illustrate the issue your describing?
From: icestar [...] inbox.ru
On Thu Sep 02 07:30:27 2010, BOBTFISH wrote: Show quoted text
> I was under the impression that this was working. > > Can you provide a failing test case to illustrate the issue your
describing? Here is the test script file.
Subject: test_storage.pl
#!/usr/bin/perl package Person; use Moose; use namespace::autoclean; use MooseX::Storage; with Storage; has name => ( is => 'rw', isa => 'Str', ); has surname => ( is => 'rw', isa => 'Str|Undef', ); package main; use Data::Dumper; my $person = new Person(name => 'Dima', surname => 'White'); my $result = $person->pack; # Here I get the result hash with 'name' and 'sername' keys print Dumper($result); $person = new Person(name => 'Dima', surname => undef); $result = $person->pack; # Here I get the result hash with 'name' key only. And where is 'surname' key? print Dumper($result); exit 0;
I believe release 0.47 should do what you need. If not, please re-open and clarify the problem.