Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2013 16:01
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 anonymous/4967456 to your computer and use it in GitHub Desktop.
Save anonymous/4967456 to your computer and use it in GitHub Desktop.
class Example {
method foo {
say 'foo'
}
}
{
CATCH {
when X::Method::NotFound {
if $_.typename ~~ /Example/ {
say "Go away! There's no {$_.method} here!";
return();
}
};
default { die $_ }
};
my $test = Example.new;
$test.foo; # Shouldn't die
$test.bar; # Shouldn't die, explicitly handled
$test.foo; # Shouldn't die
'foo'.foo; # Should die
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment