Subject: | UNIVERSAL::require does not reset $@ |
The synopsis suggests to use U::require as:
$module->require or die $@;
However, ->require does not reset $@ if the module is already loaded.
So if a user would (as DBIx::Class currently does) do something like this:
$module->require or die $@;
...
eval { ... some code that dies ... };
warn $@ if $@
...
$module->require or die $@;
The code will die for completely the wrong reasons.
The fix is to add an eval { 1 }; at the top of sub require { }, so the
code in the synopsis can still be used, and is backwards compatible.