You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Performance gain, if any, would be minimal as it is implemented with grep.
I did evaluate from a performance standpoint. The only option that I saw from that standpoint would be to use a memory map on the read. Incorporating an additional dependency would be counter to the Tiny intent.
I agree that readability it similar. My thought is that adding the pattern argument makes the code more concise and keeps less experience developers away from challenges with grep that people seem to experience. While I'm an old hand at grep, I did trip up a few times in writing the voluminous but simple test cases.
One additional point that I mentioned in the pull request but not the issue is that Path::Iterator::Rule does implement pattern for restricting file names. As such, using a similar argument is consistent with its admittedly more complex cousin.
I debated about creating the pull request to begin with since it is not a "major" enhancement - meaning one that extends a limitation or adds a whole new capability. What pushed me over the edge to write and submit it is that Path::Tiny cannot be sub-classed to add pattern.
Limit those lines returned from path->lines to only those lines matching a regexp - path->lines(pattern => qr/Line/).
I have submitted a pull request (lbe/Path-Tiny lines_pattern) for the same.
The text was updated successfully, but these errors were encountered: