Skip Menu |
 

This queue is for tickets about the Search-Dict CPAN distribution.

Report information
The Basics
Id: 124033
Status: rejected
Priority: 0/
Queue: Search-Dict

People
Owner: Nobody in particular
Requestors: user42_kevin [...] yahoo.com.au
Cc:
AdminCc:

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



Subject: suggest way to skip some lines
Date: Mon, 08 Jan 2018 17:54:45 +1100
To: bug-Search-Dict [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
Download (untitled) / with headers
text/plain 868b
As an idea for a feature, it could be good if Search::Dict had a way to ignore some unwanted lines when it searches. I thought to use it on some OEIS "B-files" which have lines like # some comment 1 838 2 4378 3 547894 4 8429138492 where want to ignore "#" comments (and perhaps blank lines at end of file, though that should be abnormal). I used an "xfrm" to get the first number as key, and thought perhaps return undef from it could mean an unwanted line. I'd have in mind look() simply reading (and xfrm-ing etc) next line until a wanted one. A predicate func or a regexp of wanted or unwanted could also suit. Even a readline func parameter which could do various strange reading. A tied handle could have a special readline I imagine, but a func parameter may be easier than a class .. and can have more than one way to do it eh ... :)
Download (untitled) / with headers
text/plain 238b
Given the various ways to do what you describe, I don't plan to add new features to Search::Dict. For example, for skipping leading lines you can use or adapt something like https://metacpan.org/release/Tie-Handle-Offset Regards, David


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.