Re: Windows paths in glob



"BM" == Ben Morrow <ben@xxxxxxxxxxxx> writes:

BM> Quoth Gunnar Hjalmarsson <noreply@xxxxxxxxx>:
>>
>> A long time ago I decided to use opendir() and readdir() instead of
>> glob(). It may not be as 'elegant', but it works flawlessly without
>> escaping spaces.

BM> To save Uri the trouble of pointing it out :), File::Slurp now has a
BM> read_dir function.

it has always had a read_dir function! its advantages are a simpler API
(no need for a handle, opendir, closedir calls) and it filters out . and
... for you. a minor disadvantage (and very minor IMO) is that it can't
iterate in scalar mode so you get one dir entry at a time. that would
only matter if your dir was enormous and i mean very big.

future plans include passing in a regex or code ref to filter for
you. yeah, you can use grep on the output but it is slightly shorter
that way.

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.