Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

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



Subject: Moo::Object::new ignores BUILDARGS
The Moo version dies... package Goose; use Moose; sub BUILDARGS { +{} } Goose->new("bar"); package Goo; use Moo; sub BUILDARGS { +{} } Goo->new("bar");
Subject: Re: [rt.cpan.org #99837] Moo::Object::new ignores BUILDARGS
Date: Mon, 27 Oct 2014 12:18:47 +0100
To: bug-Moo [...] rt.cpan.org
From: Peter Rabbitson <ribasushi [...] cpan.org>
On 10/27/2014 12:16 PM, Toby Inkster via RT wrote: Show quoted text
> package Goose; > use Moose; > ... > > package Goo; > use Moo;
Utterly offtopic, but this gives a while new meaning to "Grey Goo"
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #99837] Moo::Object::new ignores BUILDARGS
Date: Mon, 27 Oct 2014 13:53:06 +0100
To: bug-Moo [...] rt.cpan.org
From: ilmari [...] ilmari.org (Dagfinn Ilmari Mannsåker)
"Toby Inkster via RT" <bug-Moo@rt.cpan.org> writes: Show quoted text
> The Moo version dies... > > package Goo; > use Moo; > sub BUILDARGS { +{} } > Goo->new("bar");
Data point: This only happens if the class has no attributes: $ perl -Moo -E 'sub BUILDARGS { +{} } say Class->new("wibble")->foo' Odd number of elements in anonymous hash at /home/ilmari/.perlbrew/libs/20.1@std/lib/perl5/Moo/Object.pm line 25. $ perl -Moo -E 'has foo => is => ro => default => 42; sub BUILDARGS { +{} } say Class->new("wibble")->foo' 42 $ perl -Moo -E 'say Moo->VERSION' 1.006001 -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen
This changed in two ways: First, Moo 2.0 stopped checking the arguments to ->new at all if there were no attributes. In the next release, it will be calling BUILDARGS for ->new calls, even if there are no attributes.
Fixed in 2.000002