Subject: | Obscure error message when init_arg => undef, required => 1 |
The following obviously nonsensical code (obvious being a relative term, it took me a while to notice that the attribute was both required and ignored during construction)
package Foo;
use Moo;
has options => (
is => 'ro',
init_arg => undef,
required => 1,
);
Foo->new;
Results in the following somewhat obscure error message:
Use of uninitialized value $required_init[0] in join or string at /home/dj/tmp/lib/perl5/Method/Generate/Constructor.pm line 180.
Please consider making it less obscure.
Thanks!
Diab