Skip to content

Instantly share code, notes, and snippets.

@ab5tract
Last active December 9, 2019 14:41
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 ab5tract/e71a6d43cdc63f061a07492c9f8a31c4 to your computer and use it in GitHub Desktop.
Save ab5tract/e71a6d43cdc63f061a07492c9f8a31c4 to your computer and use it in GitHub Desktop.
subset NonExistentFile of Str where { ! $_.IO.e }
multi sub check-file (NonExistentFile $file, $force where *.&so) { True }
multi sub check-file (Str $file, $force where { !$_ }) { True }
multi sub check-file (Str $file, $force where *.&so) { False }
my $force = False;
subset PassedCheck of Str where { check-file($_, $force) }
use Test;
# touch /tmp/f
ok "/tmp/f" ~~ PassedCheck;
$force = True;
nok "/tmp/f" ~~ PassedCheck;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment