在穆斯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)
是的,都失敗了。 –