Subject: | useless error message on moose attribute when parent class constructor made an object not based on a hash reference |
This error message:
Not a HASH reference at (eval 188)[C:/Perl/lib/Eval/Closure.pm:125] line 9.
Comes from this code:
{
package NonHashref;
sub new { bless [], shift }
}
{
package NonHashref::Subclassed;
use Moose;
extends "NonHashref";
has thing => ( is => 'rw', default => sub { 1 } );
}
like
exception { NonHashref::Subclassed->new->thing },
qr/Constructor of parent class of NonHashref::Subclassed returned an object based on ARRAY.*extends-non-moo/,
'non-hashref constructor in parent class results in useful error message';
Currently the same issue is being discussed in Moo:
https://github.com/moose/Moo/pull/5