Skip to content

Instantly share code, notes, and snippets.

@awwaiid
Last active August 24, 2016 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awwaiid/faa4a37e5769337f3b01fca111a7925c to your computer and use it in GitHub Desktop.
Save awwaiid/faa4a37e5769337f3b01fca111a7925c to your computer and use it in GitHub Desktop.
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