Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 86090
Status: resolved
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: bokutin [...] cpan.org
Cc:
AdminCc:

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



Subject: FOREIGNBUILDARGS is not called if no attrs by has.
Subject: constructor.patch
diff --git a/lib/Moo.pm b/lib/Moo.pm index 388cbba..6899253 100644 --- a/lib/Moo.pm +++ b/lib/Moo.pm @@ -93,6 +93,9 @@ sub _set_superclasses { Moo->_constructor_maker_for($target) ->register_attribute_specs(%{$old->all_attribute_specs}); } + elsif (!$target->isa('Moo::Object')) { + Moo->_constructor_maker_for($target); + } no warnings 'once'; # piss off. -- mst $Moo::HandleMoose::MOUSE{$target} = [ grep defined, map Mouse::Util::find_meta($_), @_ diff --git a/t/foreignbuildargs.t b/t/foreignbuildargs.t index 291bd57..c5ef28e 100644 --- a/t/foreignbuildargs.t +++ b/t/foreignbuildargs.t @@ -23,11 +23,21 @@ use Test::More; my ($class, %args) = @_; return $args{attr}; } + + package t::ext_non_moo_strict::without_attr; + use Moo; + extends qw( t::non_moo_strict ); + + sub FOREIGNBUILDARGS { + my ($class, %args) = @_; + return $args{attr2}; + } } my $non_moo = t::non_moo_strict->new( 'bar' ); my $ext_non_moo = t::ext_non_moo_strict::with_attr->new( attr => 'bar', attr2 => 'baz' ); +my $ext_non_moo2 = t::ext_non_moo_strict::without_attr->new( attr => 'bar', attr2 => 'baz' ); is $non_moo->attr, 'bar', "non-moo accepts params"; @@ -35,6 +45,8 @@ is $ext_non_moo->attr, 'bar', "extended non-moo passes params"; is $ext_non_moo->attr2, 'baz', "extended non-moo has own attributes"; +is $ext_non_moo2->attr, 'baz', + "extended non-moo passes params"; done_testing;
Thank you for the patch. It will be included in the next release.
Fixed in 1.003000