Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

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

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

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



Subject: asserter checks for truth not definedness
Method::Generate::Accessor generates an asserter using logic similar to do { _generate_get() } || die. This is problematic when generating delegations, as it fails for non true (but valid) values. I've provided a simple test exercising this bug, which outputs Attempted to access '_string' but it is not set at (eval 15) line 4. the problem code areas are from what I can tell https://metacpan.org/source/MSTROUT/Moo-1.000008/lib/Method/Generate/Accessor.pm#L166 https://metacpan.org/source/MSTROUT/Moo-1.000008/lib/Method/Generate/Accessor.pm#L511
Subject: test.pl
package Bar; sub foo { die; print ${$_[0]}; } package Foo; use Moo; has _string => ( is => 'rw', default => sub { 0 }, handles => { bar => '${\\Bar->can("foo")}' }, clearer => '_clear_string', ); package main; my $f = Foo->new(); $f->_string; $f->bar;
This has been addressed in commit 43a43bffef of yet to be released Moo.