Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanstowe/io-path-mode
Augment Raku's IO::Path to provide a mode method.
https://github.com/jonathanstowe/io-path-mode
file mode raku rakudo
Last synced: 18 days ago
JSON representation
Augment Raku's IO::Path to provide a mode method.
- Host: GitHub
- URL: https://github.com/jonathanstowe/io-path-mode
- Owner: jonathanstowe
- License: artistic-2.0
- Created: 2016-01-07T20:08:13.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-07T08:46:51.000Z (over 2 years ago)
- Last Synced: 2023-04-22T17:06:59.623Z (over 1 year ago)
- Topics: file, mode, raku, rakudo
- Language: Raku
- Homepage:
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
# IO::Path::Mode
Augment Raku's IO::Path with a .mode() method to get the file mode
![Build Status](https://github.com/jonathanstowe/IO-Path-Mode/workflows/CI/badge.svg)
## Synopsis
```raku
use IO::Path::Mode;
my $mode = "some-file".IO.mode;
say $mode.set-user-id ?? 'setuid' !! 'not setuid';
say $mode.user.execute ?? 'executable' !! 'not executable';
say $mode.file-type == IO::Path::Mode::File ?? 'file' !! 'something other than a normal file';
...
```
## Description
This augments the type ```IO::Path``` to provide a ```.mode``` method
that allows you to get at the file permissions (or mode.) It follows
the POSIX model pf user, group and other permissions and consequently
may not make a meaningful result on e.g. Windows (although the underlying
calls appear to return something approximating the correct answer.)If you have a more recent rakudo that provides a ```mode``` method, it
will replace that method with one that returns an ```IO::Path::Mode```
object rather than an ```IntStr```, this is a transitional arrangement
and will be deprecated in a future release in favour of a different
method name.It relies on some non-specified functionality in the VM so may probably
only work with Rakudo on MoarVM.This is mostly provided as some relief for not having the functionality
directly exposed in Rakudo and as a discussion board for the best way
of implementing the functionality going forward.## Installation
Assuming you have a working Rakudo installation you should be able to install this with *zef* :
# From the source directory
zef install .# Remote installation
zef install IO::Path::Mode
## Support
I welcome suggestions, patches and bug reports at https://github.com/jonathanstowe/IO-Path-Mode/issues
I'd be particularly interested in suggestions relating to making
the mode mutable and adding a multi candidate for 'chmod' that
can take an ```IO::Path::Mode``` object.## Licence
This is free software.
Please see the [LICENCE](LICENCE) file in the distribution
© Jonathan Stowe 2016 - 2021