Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created March 21, 2017 21:40
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 gfldex/615a2926fe92c447a3eef5e3ba089a18 to your computer and use it in GitHub Desktop.
Save gfldex/615a2926fe92c447a3eef5e3ba089a18 to your computer and use it in GitHub Desktop.
class IO::RecursivePath is IO::Path {
multi method dir(|rest) {
# callsame().map({
# my $recurse = ();
# $recurse = dir(.Str, :recursive) if .d;
# |($recurse.Slip, .IO)
# });
gather for callsame() {
take dir(.Str, :recursive) if .d;
take .IO;
}
}
}
sub dir($path = '.', :$recursive) {
IO::RecursivePath.new($path.Str).dir;
}
.Str.say for dir(:recursive);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment