Created
October 26, 2023 20:15
-
-
Save tbrowder/86176edb54d584f8851b20325f796410 to your computer and use it in GitHub Desktop.
Demo CATCH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub resource-exists($path? --> Bool) is export { | |
return False if not $path.defined; | |
my $exists = $?DISTRIBUTION.content($path); # may die | |
return True if $exists; | |
} | |
{ | |
my $return = resource-exists; | |
say "Returned $return"; | |
CATCH { | |
default { | |
say "Error ", .^name, ': ',.Str; | |
$return = False; | |
.resume; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment