Closed bigpresh closed 2 years ago
@bigpresh : hi, thanks for the pullreq. I think I/we can come up with a more meaningful test though: pushing values into an array + is_deeply().
I appreciate the thought and the PR, but iterating without modifying is trivially done getting a filehandle via openr
and iterating in a normal for
loop. It may seem similar to edit_lines
, but that has to juggle two filehandles (including one temp file) to efficiently read and write and do an atomic replacement at the end, so it isn't trivial in the same way. I'm going to pass on accepting this PR.
Add a
for_lines()
method, which behaves similarly toedit_lines
, calling a callback for every line, but without changing the file.Shares the guts of edit_lines, refactored to _iterate_lines() to share.