Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

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

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

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



Subject: Default scalars don't initialize when value is false
I saw the blog post about 1.001 and noticed that 'default' supposedly accepted simple scalars now, but when I tried it my program died. It works with defaults of a true value, but not false ones: *$ perl -le 'use Moo; has ascalar => (is => "ro", default => 0); has asub => (is => "ro", default => sub {0}); my $m = main->new; print $m->asub; print $m->ascalar' 0 Use of uninitialized value in print at -e line 1.
This is only an issue for eager default values, so a workaround for now would be to make the attribute lazy.
And I have a test and fix in place, so this should be resolved in the next Moo release.
Fixed in Moo 1.002000