in reply to Re^3: Edge case in Text::Glob
in thread Edge case in Text::Glob

Hmm you linked to File::Glob which is another flavor than glob IIRC.

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

Replies are listed 'Best First'.
Re^5: Edge case in Text::Glob
by Fletch (Bishop) on Mar 02, 2022 at 16:29 UTC

    Quoth perldoc -f glob

    This operator is implemented using the standard "File::Glob" extension. See File::Glob for details, including "bsd_glob", which does not treat whitespace as a pattern separator.

    Edit: point taken though; not sure what the other modules sit on top of if not the core glob.

    Additionally: I'm not extremely surprised if other implementations mirror the details of the builtin glob as far as their behaviors go.

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

      > Additionally: I'm not extremely surprised if other implementations mirror the details of the builtin glob as far as their behaviors go.

      Tho I don't even know how to generate a test-suite for that.

      It's mind-blowing

      • alterations can be nested
      • "nested" character classes do not exist but what are the exact escaping rules then?
      • how do you test globing on filenames which a particular file-system doesn't allow °
      • escaping of "glob-metas" must be reflected on "re-metas" and vice versa
      • how do you test that no unintened re-meta was injected, without being escaped?
      • I just noticed that Text::Glob translates {x,y} to (x|y) which means you get capture groups as a side effect.

      There is more for sure ...

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

      °) a quick test on Windows

      DB<152> open my $fh ,">", "$_" or say "ERROR:'$_' $!" for qw/~ [ ] + { } * ?/ ERROR:'*' Invalid argument ERROR:'?' Invalid argument DB<153> x <?> 0 '[' 1 ']' 2 '{' 3 '}' 4 '~' DB<154>

      see also this SO answer: what-characters-are-forbidden-in-windows-and-linux-directory-names