Skip to content

Instantly share code, notes, and snippets.

@FCO
Created June 15, 2022 11:53
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 FCO/088dd067dcce838111b4d95c5328d56e to your computer and use it in GitHub Desktop.
Save FCO/088dd067dcce838111b4d95c5328d56e to your computer and use it in GitHub Desktop.
multi trait_mod:<is>(Routine $ref, Bool :$path-checked) {
$ref.wrap: -> $path, |c {
do if $path.starts-with: "bla/" {
callwith "other/path", |c
} else {
callsame
}
}
}
sub do-something-with-path($path) is path-checked {
say $path
}
sub do-something-else-with-path($path) is path-checked {
say " something else: ", $path
}
do-something-with-path "bla/ble";
do-something-with-path "ble/bli";
do-something-else-with-path "bla/ble";
do-something-else-with-path "ble/bli"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment