1File::Zglob(3) User Contributed Perl Documentation File::Zglob(3)
2
3
4
6 File::Zglob - Extended globs.
7
9 use File::Zglob;
10
11 my @files = zglob('**/*.{pm,pl}');
12
14 WARNINGS: THIS IS ALPHA VERSION. API MAY CHANGE WITHOUT NOTICE
15
16 Provides a traditional Unix glob(3) functionality; returns a list of
17 pathnames that matches the given pattern.
18
19 File::Zglob provides extended glob. It supports "**/*.pm" form.
20
22 zglob($pattern) # => list of matched files
23 my @files = zglob('**/*.[ch]');
24
25 Unlike shell's glob, if there's no matching pathnames, () is
26 returned.
27
29 A glob pattern also consists of components and separator characters. In
30 a component, following characters/syntax have special meanings.
31
32 "*" When it appears at the beginning of a component, it matches zero or
33 more characters except a period (.). And it won't match if the
34 component of the input string begins with a period.
35
36 Otherwise, it matches zero or more sequence of any characters.
37
38 "**"
39 If a component is just **, it matches zero or more number of
40 components that match *. For example, src/**/*.h matches all of the
41 following patterns.
42
43 src/*.h
44 src/*/*.h
45 src/*/*/*.h
46 src/*/*/*/*.h
47 ...
48
49 "?" When it appears at the beginning of a component, it matches a
50 character except a period (.). Otherwise, it matches any single
51 character.
52
53 "[chars]"
54 Specifies a character set. Matches any one of the set. The syntax
55 of chars is the same as perl's character set syntax.
56
57 "{pm,pl}"
58 There is alternation.
59
60 "example.{foo,bar,baz}" matches "example.foo", "example.bar", and
61 "example.baz"
62
64 "**/*" form makes deep recursion by soft link. zglob throw exception if
65 it's deep recursion.
66
68 Win32
69 Zglob supports Win32. zglob() only uses '/' as a path separator.
70 Since zglob() accepts non-utf8 strings. CP932 contains '\'
71 character as a second byte of multibyte chars.
72
74 File order is not compatible with shells.
75
77 Tokuhiro Matsuno <tokuhirom AAJKLFJEF GMAIL COM>
78
80 Most code was translated from gauche's fileutil.scm.
81
82 glob_to_regex function is taken from Text::Glob.
83
85 File::DosGlob, Text::Glob, gauche's fileutil.scm
86
88 Copyright (C) Tokuhiro Matsuno
89
90 This library is free software; you can redistribute it and/or modify it
91 under the same terms as Perl itself.
92
93
94
95perl v5.30.0 2019-07-26 File::Zglob(3)