我正在尝试将别名与MooseX::Aliases和MooseX::Constructor::AllErrors 一起使用
然而,两人似乎并没有很好地配合。考虑以下示例:
package Alias
{
use Moose;
use MooseX::Aliases;
use MooseX::Constructor::AllErrors;
has foo => (
is => 'rw', isa => 'Str', required => 1, alias => 'bar'
);
}
use strict;
use warnings;
use Alias;
my $obj;
eval {
$obj = Alias->new( bar => 'alias_value' );
};
if ($@)
{
foreach my $error ( $@->errors )
{
print $error ."\n";
print $error->message ."\n";
}
exit 1;
}
print $obj->bar ."\n";
$obj->foo( 'new_alias_value' );
print $obj->foo."\n";
1;
这应该允许我使用“bar”别名创建一个 Alias 对象......不是吗?有谁知道是否MooseX::Constructor::AllErrors
应该支持别名属性?