Make File::Glob::csh_glob consisent wrt '"\
File::Glob::csh_glob, which is the routine implementing Perl’s own
glob function, is not consistent in its treatment of quotation marks
and backslashes. It differs depending on whether there are white-
space characters in the pattern both preceded and followed by non-
whitespace.
Without whitespace, quotation marks are treated literally and back-
slashes are treated as escapes that cause metacharacters to be treated
literally. So
<"foo*">
looks for files with literal quotation marks in their name.
With whitespace, quotation marks are treated as word delimiters, so
<"foo copy*">
will find file names matching /^foo copy/. Backslash escapes are pro-
cessed twice, so one has to write
glob '\\\** .\\\**'
to find files beginning with a literal ‘*’ or ‘.*’. But simply
glob '\**'
to find files beginning with ‘*’. (Note that <> is a double-quotish
operator, so in <> those would have to be quadruple and double back-
slashes, respectively.)
There are two problems with the code:
1) Text::Parsewords is only used when there is whitespace present. It
should be used also for quotation marks, too, if they exist.
2) Text::Parsewords should not be removing backslash escapes.
3) Actually, there’s a third. A final escaped space should also go
through Text::ParseWords, instead of being stripped.
This commit fixes both things.