tlhackque has asked for the wisdom of the Perl Monks concerning the following question:
Before re-inventing the wheel, thought I should see if the wise monks have a solution:
Consider a program with a list of matching rules for files, say:
Now, consider a find-like program that traverses a directory (or otherwise gets a list of candidate files) and applies each candidate file to the ruleset, selecting zero or 1 actions.
Clearly, the user would expect the selected action to be the most specific match - which seems like "the one satisfied by using the fewest/least powerful wildcards from the selected rule"
Algorithimicly, it might be something like:
Alternatively, the apache config file rules would work, except that in this case one wants only the final action to be applied.
I would have expected that this problem has been solved many times before, but haven't seen it in CPAN or elswhere. (I'm not wedded to the exact syntax used above.) Any pointers? Any solutions?
thanks
This communication may not represent my employer's views, if any, on the matters discussed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Glob best match?
by moritz (Cardinal) on Jun 29, 2011 at 13:38 UTC | |
|
Re: Glob best match?
by Anonymous Monk on Jun 29, 2011 at 13:03 UTC | |
|
Re: Glob best match?
by graff (Chancellor) on Jun 30, 2011 at 10:31 UTC | |
|
Re: Glob best match?
by pklausner (Scribe) on Jun 30, 2011 at 10:15 UTC |