Am 12.07.2012 13:50, schrieb Gabor Szabo:
On Thu, Jul 12, 2012 at 2:31 PM, Tadeusz Sośnierz <tadzi...@gmail.com> wrote:
On Thu, 12 Jul 2012 13:27:26 +0200, Gabor Szabo <ga...@szabgab.com> wrote:

Hi,

is there a way to capture warnings in Perl 6 - similar to
$SIG{__WARN__} in Perl 5 ?

Gabor


CONTROL block seems to be the solution.

$ perl6 -e 'warn "oh noes"; CONTROL { default { say "caught: $_" } }'
caught: oh noes

Thanks, but:

use v6;

say 'before';
warn "oh noes";
say 'between';
CONTROL {
        default {
                say "caught: $_";
        }
}
say 'after';

prints:

before
caught: oh noes


Where is 'between' and 'after' ?

I've just added a .resume method to class Exception in Rakudo, along with a method .resumable, which checks if .resume may be called.

Cheers,
Moritz

Reply via email to