New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement IO::CatHandle.handles #1546

Closed
zoffixznet opened this Issue Feb 20, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@zoffixznet
Contributor

zoffixznet commented Feb 20, 2018

Looking at RT#132885, it seems like it could be handy to have IO::CatHandle.handles method (or io-handles to differentiate from handles the verb) that simply returns a Seq of the handles. Starting with the $!active-handle and calling .next-handle on each .pull-one. Then the code in that ticket could be just written like:

    for $*ARGFILES.handles -> $fh {
        put "NEWFILE:";
        put "$fh.path():$(++$) $_" for $fh.lines: 3;
    }

@zoffixznet zoffixznet added the IO label Feb 20, 2018

@zoffixznet zoffixznet self-assigned this Feb 20, 2018

zoffixznet added a commit that referenced this issue Feb 25, 2018

Implement IO::CatHandle.handles
Lets the user work on source handles individually, which is
especially handy when working with $*ARGFILES. e.g.:

    # print at most the first 2 lines of each file in $*ARGFILES:
    .say for flat $*ARGFILES.handles.map: *.lines: 2

Addresses R#1546 #1546

zoffixznet added a commit to perl6/roast that referenced this issue Feb 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment