File::Zglob - Extended globs.
use File::Zglob; my @files = zglob('**/*.{pm,pl}');
WARNINGS: THIS IS ALPHA VERSION. API MAY CHANGE WITHOUT NOTICE
Provides a traditional Unix glob(3) functionality; returns a list of pathnames that matches the given pattern.
File::Zglob provides extended glob. It supports **/*.pm form.
**/*.pm
my @files = zglob('**/*.[ch]');
Unlike shell's glob, if there's no matching pathnames, () is returned.
A glob pattern also consists of components and separator characters. In a component, following characters/syntax have special meanings.
*
When it appears at the beginning of a component, it matches zero or more characters except a period (.). And it won't match if the component of the input string begins with a period.
Otherwise, it matches zero or more sequence of any characters.
**
If a component is just **, it matches zero or more number of components that match *. For example, src/**/*.h matches all of the following patterns.
src/*.h src/*/*.h src/*/*/*.h src/*/*/*/*.h ...
?
When it appears at the beginning of a component, it matches a character except a period (.). Otherwise, it matches any single character.
[chars]
Specifies a character set. Matches any one of the set. The syntax of chars is the same as perl's character set syntax.
{pm,pl}
There is alternation.
"example.{foo,bar,baz}" matches "example.foo", "example.bar", and "example.baz"
**/* form makes deep recursion by soft link. zglob throw exception if it's deep recursion.
**/*
Zglob supports Win32. zglob() only uses '/' as a path separator. Since zglob() accepts non-utf8 strings. CP932 contains '\' character as a second byte of multibyte chars.
Tokuhiro Matsuno <tokuhirom AAJKLFJEF GMAIL COM>
Most code was translated from gauche's fileutil.scm.
glob_to_regex function is taken from Text::Glob.
File::DosGlob, Text::Glob, gauche's fileutil.scm
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install File::Zglob, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Zglob
CPAN shell
perl -MCPAN -e shell install File::Zglob
For more information on module installation, please visit the detailed CPAN module installation guide.