Skip to content

Instantly share code, notes, and snippets.

@awwaiid awwaiid/catch-control.p6
Last active Aug 24, 2016

Embed
What would you like to do?
sub no-catch-control {
die "no-catch-control exception";
}
sub catch-control {
CONTROL {
say "CONTROL: {$_.gist}";
die "control exception";
}
die "catch-control exception";
}
say "**** no catch control ****";
for 1 {
no-catch-control;
CATCH {
say "EXCEPTION: {$_.gist}";
next;
}
}
say "**** WITH catch control, dies upon 'next' in CATCH ****";
for 1 {
catch-control;
CATCH {
say "EXCEPTION: {$_.gist}";
next;
}
}
**** no catch control ****
EXCEPTION: no-catch-control exception
in sub no-catch-control at catch-control.p6 line 2
in block <unit> at catch-control.p6 line 19
**** WITH catch control, dies upon 'next' in CATCH ****
EXCEPTION: catch-control exception
in sub catch-control at catch-control.p6 line 12
in block <unit> at catch-control.p6 line 31
CONTROL: Died with CX::Next
control exception
in sub catch-control at catch-control.p6 line 9
in block <unit> at catch-control.p6 line 31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.