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.


In reply to Glob best match? by tlhackque

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.