Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Edge case in Text::Glob

by salva (Canon)
on Mar 01, 2022 at 16:19 UTC ( [id://11141732]=note: print w/replies, xml ) Need Help??


in reply to Edge case in Text::Glob

IMO, Text::Glob::glob_to_regex code is not too difficult to understand. If you had found an issue there you can try fixing it and submitting a patch.

Also, I don't quite remember the details, but a long time ago I found out that Text::Glob was not good enough for my purposes and so I wrote my own version (Net::SFTP::Foreign::Helpers::_glob_to_regex).

Retrospectively, what I learned from there is that rolling out your own version of a glob-to-regex compiler supporting basic wildcards is not too difficult. But then, last year, I had to write a feature rich glob-to-regex compiler (in Scala this time, scala-glob), and it got quite complex.

IIRC, one of the main limitations of Text::Glob is that you can not use it efficiently to match globs spanning more than a directory level (as in f*oo/b*ar/*.txt) against tree data structures like file systems.

Replies are listed 'Best First'.
Re^2: Edge case in Text::Glob
by LanX (Saint) on Mar 01, 2022 at 16:37 UTC
    > If you had found an issue there you can try fixing it and submitting a patch.

    well sure, but you know the song "don't reinvent the wheel" and I doubt I'm the first one using it.

    I also had to realize that there are many "glob" dialects around, so I first had to analyze what Perl's file glob is doing.

    To my surprise (and horror) I noticed that <KSR*> will match case insensitive on Win (eg Ksr_1 ) while being case sensitive on Linux. That's a portability issue IMHO.

    And globbing in the file explorer won't have any idea of character classes.

    Hence I don't even have a clear picture what the requirements should be for a reimplementation, or if Text::Glob is even patchable.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      It's explicitly noted (a couple levels deep, granted) that glob without extra flags is implicitly case insensitive for VMS and Win32.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141732]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-26 03:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found