Last active
December 9, 2019 14:41
-
-
Save ab5tract/e71a6d43cdc63f061a07492c9f8a31c4 to your computer and use it in GitHub Desktop.
This file contains 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
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