Subject: | Misleading error "class name X does not match class->name Y" |
The real cause of the error is a missing required attribute.
In a simple case, Moose outputs a reasonable error message:
$ perl -e 'package C1; use Moose; has x => (is=>qw(rw),required=>1); package main; my $obj=C1->new'
Attribute (x) is required at [...]/Moose/Exception.pm line 38
[...]
However, in a slightly more complicated case, Moose outputs a completely misleading error:
$ perl -e 'package C1; use Moose; has x => (is=>qw(rw),required=>1); package C2; use Moose; extends "C1"; package main; my $obj=C2->new'
class_name (C2) does not match class->name (C1) at [...]/Moose/Exception.pm line 38
[...]
Debugging such a message is really annoying (esp. if you just get the error traceback from a user without having access to his computer).
I think it is a regression, but I am not able now to install an older Moose to check it. BTW: is there some trick how to do this (e.g. with perlbrew & backpan)?