Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the MooseX-Aliases CPAN distribution.

Report information
The Basics
Id: 52132
Status: resolved
Priority: 0/
Queue: MooseX-Aliases

People
Owner: Nobody in particular
Requestors: perl [...] froods.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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(-)
Hi Karen! The attached file provides a more self-contained and slightly more simplified testcase. Regards, -- Shlomi Fish On Fri Nov 27 15:03:22 2009, perl@froods.org wrote: Show quoted text
> > 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? > >
#!/usr/bin/perl package Foo; use Moose; use MooseX::StrictConstructor; use MooseX::Aliases; has attr => ( is => 'rw', isa => 'Str', alias => 'alias_attr', ); __PACKAGE__->meta->make_immutable; package main; use strict; use warnings; my $obj = Foo->new(alias_attr=>"blah"); print $obj->alias_attr; 1;
This should be fixed in 0.06.