我已经整理了一个小测试用例来演示我的问题:
package P1; use Moose; use MooseX::Storage; with Storage; has 'blah' => ( is => 'rw', ); package P2; use Moose; use MooseX::Storage; with Storage; has 'lol' => ( is => 'rw', traits => ['DoNotSerialize'] ); package P3; use Moose; extends 'P2'; has 'magic' => ( is => 'rw', ); package Test; my $obj = P3->new( magic => 'This ok!', lol => sub { 'weee' } ); my $stored = P1->new(blah => $obj); use Data::Dumper; print Dumper ($stored->pack);
我希望这打印对象,但不打包P2包中的'lol'属性 - 但是,我仍然可以在结果中看到这个 $stored->pack
$VAR1 = { '__CLASS__' => 'P1', 'blah' => bless( { 'magic' => 'This ok!', 'lol' => sub { "DUMMY" } }, 'P3' ) };
我使用MooseX :: Storage是错误的,还是看起来像有错误的行为?
看起来像个臭虫的Yup.你能把它变成一个使用Test :: More并将它提交到RT队列的测试,有人(可能是我)会修复它.
请注意,如果您转储$ obj-> store,您会看到该特征已正确应用于direct属性,但它似乎在继承过程中丢失了.
您可以在RT中报告针对MooseX :: Storage的错误