I can fix this by closing the old file handle and checking the new
one, but that seems like way to much work at the user level.

    quietly {
        my $limit = 5;
        for lines() {
            state $lines = 1;
            FIRST { $*ARGFILES.on-switch = { put "NEW FILE"; $lines = 1 } }
            if $lines > $limit {
                $*ARGFILES.next-handle.close;
                last unless $*ARGFILES.opened;
                next;
                }
            put "{$*ARGFILES.path}:{$lines++} $_";
            }
        }

Reply via email to