I get this when I run the test, but as you can see, both tests still show OK. I don’t like this at all. How do I turn the warnings into errors?
1..2
Allowing a native trait to automatically supply a default is deprecated. You can avoid this warning by supplying a default, builder, or making the attribute required at UserInfo.pm line 7
require UserInfo.pm called at (eval 4) line 2
main::BEGIN() called at UserInfo.pm line 0
eval {...} called at UserInfo.pm line 0
eval 'package main;
use UserInfo @{$args[0]};
1;
;' called at /packages/run.64/perl-5.14.1/lib/5.14.1/Test/More.pm line 885
Test::More::_eval('package main;\x{a}use UserInfo @{$args[0]};\x{a}1;\x{a}', 'ARRAY(0x16fa110)') called at /packages/run.64/perl-5.14.1/lib/5.14.1/Test/More.pm line 860
Test::More::use_ok('UserInfo') called at UserInfo.t line 7
ok 1 - use UserInfo;
ok 2 - require UserInfo;
Turn warnings into errors? Here you are!
If you want the script not to just die, but to fail specific tests, you can add this to the above:
See Test::Exception.
Yet another way (as I stated in comment below) is defining a warning pseudo-signal handler: