https://github.com/raku-community-modules/trait-io
Helper IO traits
https://github.com/raku-community-modules/trait-io
raku
Last synced: 5 months ago
JSON representation
Helper IO traits
- Host: GitHub
- URL: https://github.com/raku-community-modules/trait-io
- Owner: raku-community-modules
- License: artistic-2.0
- Created: 2017-04-29T17:19:33.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T14:26:13.000Z (about 2 years ago)
- Last Synced: 2025-01-23T04:26:05.287Z (10 months ago)
- Topics: raku
- Language: Raku
- Homepage: https://raku.land/zef:raku-community-modules/Trait::IO
- Size: 74.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/raku-community-modules/Trait-IO/actions)
NAME
====
Trait::IO - Helper IO traits
SYNOPSIS
========
```raku
use Trait::IO;
# Top-level is OK too; will close on scope leave
my $fh does auto-close = "foo".IO.open: :w;
# ...
```
DESCRIPTION
===========
Useful traits for working with Raku IO.
EXPORTS
=======
does auto-close
---------------
```raku
my $fh does auto-close = "foo".IO.open: :w;
```
Installs a `LEAVE` phaser to automatically close the file handle when scope is left.
Exports the constant and the `trait_mod:` multi that accepts it as a value.
Currently works only with variables and not with attributes or parameters. Patches welcome.
AUTHOR
======
Zoffix Znet
COPYRIGHT AND LICENSE
=====================
Copyright 2017 - 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.