Skip to content

Instantly share code, notes, and snippets.

@rightfold

rightfold/.pm6 Secret

Last active January 16, 2016 16:51
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 rightfold/0869cee15c3735b43417 to your computer and use it in GitHub Desktop.
Save rightfold/0869cee15c3735b43417 to your computer and use it in GitHub Desktop.
sub which(Str:D $name --> IO::Path) {
%*ENV<PATH>.split(':')
.grep(:r & :d)
.map(*.dir.first(:f & :x & {.basename eq $name}))
.first(*.defined);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment