+ - better error message for broken BUILDARGS
- provide 'no Moo::sification' to forcibly disable metaclass inflation
- switch to Devel::GlobalDestruction to correctly disarm the
Moo::sification trigger under threads
sub _generate_args_via_buildargs {
my ($self) = @_;
- q{ my $args = $class->BUILDARGS(@_);}."\n";
+ q{ my $args = $class->BUILDARGS(@_);}."\n"
+ .q{ die "BUILDARGS did not return a hashref" unless ref($args) eq 'HASH';}
+ ."\n";
}
# inlined from Moo::Object - update that first.
use strictures 1;
use Test::More;
+use Test::Fatal;
{
package Foo;
}
}
-my $f = Foo->new({ bar => 1, baz => 1 });
+like(
+ exception { Foo->new({ bar => 1, baz => 1 }) },
+ qr/BUILDARGS did not return a hashref/,
+ 'Sensible error message'
+);
done_testing;