in reply to Re^8: Non-fatal error handling with Mouse types?
in thread Non-fatal error handling with Mouse types?
"did not solicit feedback on"
But you did solicit feedback on your attempts to use Moosey type contraints in an update to the code you are undertaking. I stand by my responses; type constraints are for stopping compilation or execution of your program, and if you don't want to stop, don't use a constraint. You mentioned setting $Errstr or similar but that is only done in case of exception: packages that permit the flow to continue use a warning variable. If you want to do that it's of course perfectly fine, but using type constraints is the wrong approach as shown by your attempts and the workarounds you've been provided here.
So my feeble contributions have all been with the intent of helping you with your original question. Sometimes the right answer to "how do I do this?" is "don't."
But, did you look at coercions? Wouldn't correcting a bad value be even better than allowing it? Your coercion can also set or emit a warning if the value needs to be coerced in order to meet the constraint ... ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Non-fatal error handling with Mouse types?
by wanna_code_perl (Friar) on Oct 02, 2019 at 16:47 UTC |