1File::DosGlob(3pm) Perl Programmers Reference Guide File::DosGlob(3pm)
2
3
4
6 File::DosGlob - DOS like globbing and then some
7
9 require 5.004;
10
11 # override CORE::glob in current package
12 use File::DosGlob 'glob';
13
14 # override CORE::glob in ALL packages (use with extreme caution!)
15 use File::DosGlob 'GLOBAL_glob';
16
17 @perlfiles = glob "..\\pe?l/*.p?";
18 print <..\\pe?l/*.p?>;
19
20 # from the command line (overrides only in main::)
21 > perl -MFile::DosGlob=glob -e "print <../pe*/*p?>"
22
24 A module that implements DOS-like globbing with a few enhancements. It
25 is largely compatible with perlglob.exe (the M$ setargv.obj version) in
26 all but one respect--it understands wildcards in directory components.
27
28 For example, "<..\\l*b\\file/*glob.p?>" will work as expected (in that
29 it will find something like '..\lib\File/DosGlob.pm' alright). Note
30 that all path components are case-insensitive, and that backslashes and
31 forward slashes are both accepted, and preserved. You may have to
32 double the backslashes if you are putting them in literally, due to
33 double-quotish parsing of the pattern by perl.
34
35 Spaces in the argument delimit distinct patterns, so "glob('*.exe
36 *.dll')" globs all filenames that end in ".exe" or ".dll". If you want
37 to put in literal spaces in the glob pattern, you can escape them with
38 either double quotes, or backslashes. e.g. "glob('c:/"Program
39 Files"/*/*.dll')", or "glob('c:/Program\ Files/*/*.dll')". The
40 argument is tokenized using "Text::ParseWords::parse_line()", so see
41 Text::ParseWords for details of the quoting rules used.
42
43 Extending it to csh patterns is left as an exercise to the reader.
44
46 glob()
47
49 Should probably be built into the core, and needs to stop pandering to
50 DOS habits. Needs a dose of optimization too.
51
53 Gurusamy Sarathy <gsar@activestate.com>
54
56 • Support for globally overriding glob() (GSAR 3-JUN-98)
57
58 • Scalar context, independent iterator context fixes (GSAR 15-SEP-97)
59
60 • A few dir-vs-file optimizations result in glob importation being 10
61 times faster than using perlglob.exe, and using perlglob.bat is
62 only twice as slow as perlglob.exe (GSAR 28-MAY-97)
63
64 • Several cleanups prompted by lack of compatible perlglob.exe under
65 Borland (GSAR 27-MAY-97)
66
67 • Initial version (GSAR 20-FEB-97)
68
70 perl
71
72 perlglob.bat
73
74 Text::ParseWords
75
76
77
78perl v5.36.3 2023-11-30 File::DosGlob(3pm)