debugging - Is there a canonical way to print a stack trace in perl 6? -


in perl 5, use of carp functions. in perl 6, searching no help, , trace pragma print stacks, not 1 want. use old hack of throwing exception, catching it, , printing it:

try {     x::adhoc.new(payload => 'stack').throw;     catch { when x::adhoc { .say; } } } 

or, being little lazier:

{     die;     catch { default { .say } } } 

what's right way this?

i found answer while writing question, , decided post here since didn't show in of previous searches. perl 6's backtrace class stack trace , convert string:

say "stack: " ~ backtrace.new; 

(use backtrace.new.full see additional low-level stack frames hidden.)


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -