From: Shawn M Moore Date: Thu, 5 Feb 2009 02:07:30 +0000 (+0000) Subject: Don't require there to be a BUILDARGS method; fix undef warning X-Git-Tag: 0.19~56 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=586008537382826f6f206e5412be448a1b51dcd0 Don't require there to be a BUILDARGS method; fix undef warning --- diff --git a/lib/Mouse/Meta/Method/Constructor.pm b/lib/Mouse/Meta/Method/Constructor.pm index 5b8b5d2..a11479d 100644 --- a/lib/Mouse/Meta/Method/Constructor.pm +++ b/lib/Mouse/Meta/Method/Constructor.pm @@ -136,7 +136,7 @@ sub _generate_BUILDARGS { my $self = shift; my $meta = shift; - if ($meta->name->can('BUILDARGS') != Mouse::Object->can('BUILDARGS')) { + if ($meta->name->can('BUILDARGS') && $meta->name->can('BUILDARGS') != Mouse::Object->can('BUILDARGS')) { return '$class->BUILDARGS(@_)'; } diff --git a/t/040-existing-subclass.t b/t/040-existing-subclass.t index 38f41f8..52a9e5f 100644 --- a/t/040-existing-subclass.t +++ b/t/040-existing-subclass.t @@ -6,7 +6,7 @@ use Test::More; BEGIN { eval "use Test::Output;"; plan skip_all => "Test::Output is required for this test" if $@; - plan tests => 2; + plan tests => 3; } do { @@ -45,3 +45,15 @@ stderr_is( 'Mouse does not warn about inlining a constructor when the superclass inlined a constructor', ); +do { + package Baz; + + package Quux; + BEGIN { our @ISA = 'Baz' } + use Mouse; + + __PACKAGE__->meta->make_immutable; +}; + +ok(Quux->new); +