On Wed Oct 26 03:00:32 2011, eda@waniasset.com wrote:
> Father Chrysostomos via RT <perlbug-followup <at> perl.org> writes:
>
> >The worst breakage is that a glob pattern with spaces gets backslash
> >escapes processed three times on Unix, so use this if you want to
> find
> >all files beginning with \ or . :
> >
> >@files = <\\\\\\\\* .*>;
> >
> >Fortunately, I’ve fixed that, so you only need four backslashes now.
>
> That's great news! <g>
>
> I do wonder why this particular bug is considered a bug to be fixed,
Because it wasn’t self-consistent. These two patterns produced the same
results:
<\\\\\\\\* .*> <{\\\\,.}*>
> while the breakage with space characters is considered a feature to be
> preserved. I know there is some existing code with <*.c *.h>
A *lot* of existing code.
> but that is
> not difficult to fix - so under 'use 5.16' glob could have sensible
> semantics.
>
> >> my $dirname = shift @ARGV;
> >> my $quoted = quotemeta $dirname;
> >> my @g = glob "$quoted/*";
> >>
> >>That seems dirty, and won't work under Windows, where glob() takes
> >>backslash as a directory separator.
> >
> >Slash also works.
>
> Yup, but since backslash works too, the business of backslash-escaping
> glob
> patterns is even messier on Windows than on Unix. (at least for
> common patterns
> such as */* which might equally be given as *\* on Windows)
>
Thread Previous
|
Thread Next