Subject: | 'Defined' type unsupported |
Trying to store a moose object with an attribute with the typeconstraint
'Defined' results in an exception thrown. Ideally, it would successfully
store the object, instead of failing.
Attached is a test that demonstrates this behaviour.
Subject: | 099_bug_defined_type.t |
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 2;
BEGIN {
use_ok('MooseX::Storage');
}
{
package Foo;
use Moose;
use MooseX::Storage;
with Storage;
has 'value' => ( is => 'ro', isa => 'Defined' );
}
{
my $foo = Foo->new( value => 10 );
isa_ok( $foo, 'Foo' );
is_deeply(
$foo->pack,
{
__CLASS__ => 'Foo',
value => 10,
},
'... got the right frozen class'
);
}
{
my $foo = Foo->unpack(
{
__CLASS__ => 'Foo',
value => 10,
}
);
isa_ok( $foo, 'Foo' );
is( $foo->value, 10, '... got the right value' );
}