在穆斯1.x版,我曾经是能够做到这一点:驼鹿特质
package Class;
use Test::More tests => 1;
use Moose;
use MooseX::Types::Moose qw/Undef Str/;
eval {
has 'trait_boom' => (
is => 'rw'
, isa => Str | Undef
, default => ''
, traits => ['String']
);
};
ok ([email protected], "Created attr trait_boom, a type union of Str and Undef\[email protected]");
但是,它不再与驼鹿2.x的工作我假设这is a bug。为什么穆斯打破向后兼容性?是否有另一种方式来完成这项工作。我希望那是Undef
或Str
。我不想强制Undef
为空字符串。
我只在这里问,因为显然磁铁是打破
17:43 [perl2] -!- ERROR Closing Link: 64.200.109.13 (Banned)
是的,都失败了。 –