Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

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

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

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



Subject: Moo does not like constructors with prototypes
Moo fails when extending a non-Moo class with a prototype `()` on its constructor. Prototype mismatch: sub main::new () vs none at .../Moo/_Utils.pm line 84. A test case: { package My::Base; sub new () { my $class = shift; bless {}, $class; } 1; } use Moo; extends 'My::Base'; 1; This is using Moo==1.004002, Perl v5.18.2.
I bisected this with my test above, and found: # first bad commit: [85de1ef9dedd1a60115e475036dabaed68dc6ae2] fix FOREIGNBUILDARGS not being called when no attributes created i.e. broken in this commit.
On Fri Feb 21 11:06:41 2014, CRZEDPSYC wrote: Show quoted text
> I bisected this with my test above, and found: > # first bad commit: [85de1ef9dedd1a60115e475036dabaed68dc6ae2] fix > FOREIGNBUILDARGS not being called when no attributes created > > i.e. broken in this commit.
That commit doesn't have anything to do with the root cause of this. If your subclass includes attributes, you'll see the breakage in earlier versions. The root cause is a perl bug in its handling of the inheritance cache. I've added a workaround which will be in the next Moo release. Aside from that though, the prototype being used is really broken. Prototypes don't effect method calls, and if they did that would be specifying that ->new accepted no parameters, when it clearly accepts at least the class name.
Show quoted text
> I've added a workaround which will be in the next Moo release.
Excellent - thanks. Show quoted text
> Aside from that though, the prototype being used is really broken.
Yes, this arose when extending Curses::UI::* -- not my code. I would have added a ticket over there, but Moo used to handle the particular case fine, and Moose still does.
The fix for this is in the latest stable release.