Skip Menu |

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 80170
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: cwhitener [...] gmail.com
Requestors: kjetilk [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Simple regexp search functionality
I'm looking for a replacement for File::Data, which has problems going into Debian. I'm currently using it in my module RDF::Trine::Store::File. File::Slurp has most of what I need, but lacks the simple search functionality of File::Data, i.e. something like while (<>) { m/($regexp)/; push (@results, $1) if (defined($1)); That's of course not executable code, but I hope you get the idea. :-) It would be really nice if you could add that. Cheers, Kjetil
Hi Kjetil, Thanks for the suggestion, but it's kind of outside of the scope of the intent of the module. You can take any of the slurping modules out there today (Path::Tiny, etc.) and slurp in the lines and go through them for your manipulation. Thanks, Chase
Subject: Re: [rt.cpan.org #80170] Simple regexp search functionality
Date: Fri, 5 Oct 2018 09:27:11 -0400
To: bug-File-Slurp [...] rt.cpan.org
From: Uri Guttman <uri [...] stemsystems.com>
On 10/05/2018 07:56 AM, Chase Whitener via RT wrote: Show quoted text
> Queue: File-Slurp > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=80170 > > > Hi Kjetil, > > Thanks for the suggestion, but it's kind of outside of the scope of the intent of the module. You can take any of the slurping modules out there today (Path::Tiny, etc.) and slurp in the lines and go through them for your manipulation. > > Thanks, > Chase
wow, an RT from 2012. a simple answer is just a map. my @parts = map { /($regex) ? $1 : () } read_file( $filename ) ; so there is no need for a feature added to the module. also check out edit_file and edit_file_lines as they may be of use to you. uri