>> Hi All,
>>
>> I would like to do a Send Notify when a program of mine
>> crashes.
>>
>> How do I trap a crash?
>>
>> Is there a way to see some of the local variables in the
>> sub that crashes with the trap?
>>
>>
>> Many thanks,
>> -T

On 1/11/19 10:56 AM, Elizabeth Mattijsen wrote:
Perhaps https://docs.perl6.org/language/exceptions#Catching_exceptions could be 
enlightening?

On 11 Jan 2019, at 18:54, ToddAndMargo via perl6-users <perl6-us...@perl.org> 
wrote:


Yes. Thank you!

CATCH {
     default {
         $*ERR.say: .payload;
         for .backtrace.reverse {
             next if .file.starts-with('SETTING::');
             next unless .subname;
             $*ERR.say: "  in block {.subname} at {.file} line {.line}";
         }
     }
}

Does the program die afterward?

Each of my subs has

   my Str $SubName = &?ROUTINE.name;

Is there a way to get that in the printout from CATCH?


Many thanks,
-T

Reply via email to