Subject: | Params::Check doesn't always croak if WARNINGS_FATAL is set |
Hi,
If I set WARNINGS_FATAL, Params::Check doesn't always croak upon
error. There are two points in the check() subroutine with unguarded
simple returns:
249
250 ### did we get the arguments we need? ###
251 return if !$utmpl or !$href;
252
268 ### sanity check + defaults + required keys set? ###
269 my $defs = _sanity_check_and_defaults( $utmpl, $args, $verbose )
270 or return;
271
Additionally, the checks at line 251 are performed before
clear_error() is called, so last_error() will return any errors from a
previous call, not the current one.
This makes reporting an error more complicated:
The checks at line 251 must be duplicated in user code because if the
checks have failed last_error() can't be trusted (an incorrect error
message may be reported).
As not all errors are thrown if WARNINGS_FATAL=true, there's
no point in using exceptions to clean up error code.
Thanks! (and thanks for the module)
Diab