Help language development. Donate to The Perl Foundation
Subsets::IO
- Subsets for various types of IO::Path
instances
use Subsets::IO; say "Our script is writable and readable" if $?FILE.IO ~~ IO::Path::frw;
use Subsets::IO; sub make-conf($conf where IO::Path::dw | IO::Path::fw) { say "$conf is either a writable directory or a writable file"; } sub make-conf-file(IO::Path::E $conf) { say "$conf is a non-existent path"; } make-conf-file $?FILE.IO; # Path must NOT exist Got /home/zoffix/CPANPRC/Subsets-IO/foo.p6 # Constraint type check failed in binding to parameter '$conf'; # expected IO::Path::E but got IO::Path (IO::Path.new("/home/z...)
The module provides subsets of IO::Path:D
that additionally perform file tests and either uses the new will complain
(since Rakudo 2022.04) feature, or uses Subset::Helper
to display useful error messages on typecheck failures.
Path must exist.
Path must NOT exist.
Path must be an existing file.
Path must NOT be an existing file.
Path must be an existing directory.
Path must NOT be an existing directory.
Path must be an existing, readable file.
Path must be an existing, readable and writable file.
Path must be an existing, readable and executable file.
Path must be an existing, writeable and executable file.
Path must be an existing, readable, writable, and executable file.
Path must be an existing, readable directory.
Path must be an existing, readable and writable directory.
Path must be an existing, readable and executable directory.
Path must be an existing, writeable and executable directory.
Path must be an existing, readable, writable, and executable directory.
Zoffix Znet
Copyright 2018 Zoffix Znet
Copyright 2019 - 2022 Raku Community
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.