Subsets::IO
- Subsets for various types of IO::Path
instances
use Subsets::IO :frw;
say "Our script is writable and readable"
if $?FILE.IO ~~ IO::Path::frw;
use Subsets::IO; # export all available subsets
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 use
Subset::Helper
to dispay
useful error messages on typecheck failure.
By default, all subsets are imported. You can specify tags that match the name
of the subsets you want to import only those subsets. For example, to import
only IO::Path::E
and IO::Path::frw
, use:
use Subsets::IO :E, :frw;
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.
-
Due to R#1458, all symbols are currently exported all the time, even if specific tags are specified.
-
On typecheck failure, the error message is printed twice, due to how Rakudo's fast and slow-path binding works. If you know a good solution to that, submit a PR to
Subset::Helper
Fork this module on GitHub: https://github.com/zoffixznet/perl6-Subsets-IO
To report bugs or request features, please use https://github.com/zoffixznet/perl6-Subsets-IO/issues
Zoffix Znet (http://perl6.party/)
You can use and distribute this module under the terms of the
The Artistic License 2.0. See the LICENSE
file included in this
distribution for complete details.
The META6.json
file of this distribution may be distributed and modified
without restrictions or attribution.