CC: | bug-moosex-aliases [...] rt.cpan.org, bug-moosex-strictconstructor [...] rt.cpan.org |
Subject: | Bug in MooseX::Aliases with MooseX::StrictConstructor? |
Date: | Fri, 27 Nov 2009 12:04:03 -0800 |
To: | moose [...] perl.org |
From: | Karen Etheridge <perl [...] froods.org> |
There seems to be a bug with the way MooseX::Alias interacts with
MooseX::StrictConstructor. Here is a repro case:
package Foo;
use Moose;
use MooseX::StrictConstructor;
use MooseX::Aliases;
has attr => (
is => 'rw', isa => 'Str',
alias => 'alias_attr',
);
no Moose;
__PACKAGE__->meta->make_immutable;
1;
perl -I. -MFoo -wle'my $obj = Foo->new(alias_attr=>"blah"); print $obj->alias_attr'
Found unknown attribute(s) passed to the constructor: alias_attr at generated method (unknown origin) line 23
Foo::new('Foo', 'alias_attr', 'blah') called at -e line 1
If the make_immutable call is removed, the problem disappears. My guess is
that make_immutable does not take the alias into account when inlining the
constructor?
--
End random acts of parenting.
. . . . .
Karen Etheridge, karen@etheridge.ca GCS C+++$ USL+++$ P+++$ w--- M++
http://etheridge.ca/ PS++ PE-- b++ DI++++ e++ h(-)