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

Viewed 415

In perl 5, I would use any of the Carp functions. In perl 6, searching was no help, and the trace pragma will print all stacks, not just the one I want. I could only use the old hack of throwing an exception, catching it, and printing it:

try {
    X::AdHoc.new(payload => 'Stack').throw;
    CATCH { when X::AdHoc { .say; } }
}

Or, being a little lazier:

{
    die;
    CATCH { default { .say } }
}

What's the right way to do this?

1 Answers
Related