package MooseX::Storage::Engine;
use Moose;
-our $VERSION = '0.02';
+our $VERSION = '0.03';
our $AUTHORITY = 'cpan:STEVAN';
# the class marker when
sub collapse_attribute {
my ($self, $attr, $options) = @_;
- $self->storage->{$attr->name} = $self->collapse_attribute_value($attr, $options) || return;
+ my $value = $self->collapse_attribute_value($attr, $options);
+ return if !defined($value);
+ $self->storage->{$attr->name} = $value;
}
sub expand_attribute {
my ($self, $attr, $data, $options) = @_;
- $self->storage->{$attr->name} = $self->expand_attribute_value($attr, $data->{$attr->name}, $options) || return;
+ my $value = $self->expand_attribute_value($attr, $data->{$attr->name}, $options);
+ $self->storage->{$attr->name} = defined $value ? $value : return;
}
sub collapse_attribute_value {
'Int' => { expand => sub { shift }, collapse => sub { shift } },
'Num' => { expand => sub { shift }, collapse => sub { shift } },
'Str' => { expand => sub { shift }, collapse => sub { shift } },
+ 'Bool' => { expand => sub { shift }, collapse => sub { shift } },
# These are the trickier ones, (see notes)
# NOTE:
# Because we are nice guys, we will check
=head1 COPYRIGHT AND LICENSE
-Copyright 2007 by Infinity Interactive, Inc.
+Copyright 2007-2008 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>