File::DosGlob(3pm)
πΈ File::DosGlob π
okay bestie, so this page? It's the manual for File::DosGlob β literally "DOS like globbing and then some" β¨ Like, DOS-style wildcard matching, but upgraded. Come sit, I'll tell you everything π«Ά
β¨ SYNOPSIS β¨
require 5.004;
# override CORE::glob in current package
use File::DosGlob 'glob';
# override CORE::glob in ALL packages (use with extreme caution!)
use File::DosGlob 'GLOBAL_glob';
@perlfiles = glob "..\\pe?l/*.p?";
print <..\\pe?l/*.p?>;
# from the command line (overrides only in main::)
> perl -MFile::DosGlob=glob -e "print <../pe*/*p?>"
no cap, that second one is giving main character energy but also danger π GLOBAL_glob touches ALL packages β the manual literally says use with extreme caution! π You've been warned, babe.
π DESCRIPTION π
So this module implements DOS-like globbing, with a few lil enhancements sprinkled on top π It's largely compatible with perlglob.exe (the M$ setargv.obj version) in all but one respect β and that one respect is kind of the whole slay: it understands wildcards in directory components. π
Like for example, <..\\l*b\\file/*glob.p?> will work as expected β in that it'll find something like '..\lib\File/DosGlob.pm' alright. Yes queen, wildcards inside the directory part. Obsessed. π
Heads up bestie: all path components are case-insensitive, and both backslashes and forward slashes are accepted and preserved. Also you may have to double the backslashes if you're putting them in literally, because of perl's double-quotish parsing of the pattern. That's not me being dramatic, that's just how it is π«
Spaces in the argument delimit distinct patterns, so glob('*.exe *.dll') globs all filenames that end in ".exe" or ".dll" β¨ Two patterns, one call, we love efficiency.
But what if you want a literal space in your glob pattern? Bestie you can escape them β either with double quotes or with backslashes:
glob('c:/"Program Files"/*/*.dll')
or
glob('c:/Program\ Files/*/*.dll')
Both iconic, both valid π The argument is tokenized using Text::ParseWords::parse_line(), so see Text::ParseWords for details of the quoting rules used. (Yes, that's a real module, go read it, iykyk.)
Extending it to csh patterns is left as an exercise to the reader. π§ Like, the author literally handed you homework. Do with that what you will β¨
π EXPORTS (by request only) π
glob()β that's it. That's the export. By request only, so don't come crying when it's not there automatically π
π BUGS π
Not gonna sugarcoat it: it should probably be built into the core, and it needs to stop pandering to DOS habits. Also needs a dose of optimization too. The vibes are, uh, legacy π but we respect the elders fr fr.
π AUTHOR π
Gurusamy Sarathy <gsar@activestate.com> β thank you for your service π«Ά
π HISTORY π
the lore, chronologically, king:
- Support for globally overriding
glob()(GSAR 3-JUN-98) - Scalar context, independent iterator context fixes (GSAR 15-SEP-97)
- A few dir-vs-file optimizations result in glob importation being 10 times faster than using
perlglob.exe, and usingperlglob.batis only twice as slow asperlglob.exe(GSAR 28-MAY-97) π₯ - Several cleanups prompted by lack of compatible
perlglob.exeunder Borland (GSAR 27-MAY-97) - Initial version (GSAR 20-FEB-97) β
π¦ SEE ALSO π¦
perlperlglob.batText::ParseWords
and that's the whole page, bestie π this little number is perl v5.42.3, dated 2026-11-03 β go forth and glob responsibly πΈπ«Άβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms