Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

perl6 Catching non-fatal exceptions in autovivification

I am running analysis on about 10000 lines of numbers, and some of the lines give me errors: "Use of uninitialized value of type Any in numeric context". I am trying to catch this error to see which lines are causing the problem. However, the X::TypeCheck, and other X::* classes don't seem to do effective catching autovivification of Nil or Any. E.g.:

try { say Any + 1; CATCH { default { say "oh-no"; } }; }

still gives me answer of "1" after printing out the warning message and does not say "oh-no" that I want.

What is the proper way to catch these non-fatal autovivification errors? And by the way, is there a nuclear-powered perl6 debugger?

Thank you very much !!!

lisprog

like image 787
lisprogtor Avatar asked Jul 28 '18 16:07

lisprogtor


1 Answers

Use quietly and CONTROL instead of try and CATCH:

quietly { say Any + 1; CONTROL { default { say "oh-no" } } }
like image 174
wamba Avatar answered Sep 20 '22 12:09

wamba