B<PATTERN> is either a (scalar) string that will be preprocessed and then
compiled withB<translatestar()> or a compiled regular expression. In the
latter case, the compilation step is skipped. You should pass a regular
expression that was returned by a B<translatestar()> call withthe option
B<pathMode>.
The pre-processing of B<PATTERN> goes through the steps outlined below. The
intermediate results forthe input B<STRING> "!/src/**/.deps/"is added in
parentheses.
=over 8
=item B<*> If B<PATTERN> begins withan exclamation mark, the exclamation mark is discarded, and the B<PATTERN> is marked as negated (current "/src/**/.deps/").
=item B<*> If B<PATTERN> ends witha slash, the slash is discarded, and the B<PATTERN> is marked as a "directory match"(current "/src/**/.deps").
=item B<*> If B<PATTERN> begins witha slash, the slash is discarded, and the B<PATTERN> is marked as a "full path match"(current "src/**/.deps").
=item B<*> If B<PATTERN> is not already marked as a "full path match", every remaining slash will activate "full path match"(nomodification in this laststep).
=back
Note that the pre-processing step is skipped, ifyou pass a compiled regular
expression instead of a (scalar) string forB<PATTERN>. And actually,
B<pnmatchstar()> does not really dothe pre-processing. It is in fact done by
B<translatestar()> whencalled withthe option B<pathMode>. See
below fordetails.
The B<STRING> argument (forexample "lib/File/Globstar/") is always
pre-processed:
=over 8
=item B<*> A possible trailing slash is discarded, and the B<STRING> is then marked as representing a "directory". The example string would now be "lib/File/Globstar"without the trailing slash.
=item B<*> If full path mode is B<NOT> active (either because of a leading or innner slash in B<PATTERN>), a possible leading "directory portion"of B<STRING> is discarded. The "directory portion"is everything untiland including the lastslash in B<STRING>. The example string would have been truncated to just "Globstar"by now.
=back
The resulting B<STRING> is then compared to B<PATTERN>. If it matches, and
B<PATTERN> was not negated, 1 is returned. Likewise, ifit does not match and
B<PATTERN> was negated.
In "directory mode"(B<PATTERN> ended witha slash), a match also requires
that B<STRING> is considered a directory. It either needs a trailing slash
or you must pass the option B<isDirectory> witha truthy value.
In full path mode, the comparison continues and "ascends": The "base name"of
B<STRING> - that is the lastslash and everything following it - is discarded,
and B<pnmatchstar()> is called recursively, but always withthe option
B<isDirectory> set to 1 untila match is found. If it never matches,
the function ultimately returns false.
You can pass the following optional named arguments to B<pnmatchstar()>:
=over 8
=item B<ignoreCase TRUE|FALSE>
Compile the regular expression withthe "i"modifier so that it matches in a
case-insensitive manner.
The option is ignored, whena compiled regular expression was passed as the
first argument instead of a scalarB<PATTERN>.
=item B<isDirectory TRUE|FALSE>
Mark B<STRING> as a directory, ifB<TRUE>.
The option is ignored, whena compiled regular expression was passed
as the first argument instead of a scalarB<PATTERN>. It is also ignored
(forced to B<TRUE>), whena trailing slash was removed from B<STRING>.
Rationale: The name of a non-directory can never contain a slash.
=back
The function was introduced in version 0.2.
=item B<translatestar PATTERN[, OPTIONS]>
Compiles B<PATTERN> into a Perl regular expression or throws an exception in
case of failure. This function is used internally by B<fnmatchstar()> and
B<pnmatchstar()>.
B<OPTIONS> is an optional hash of named arguments:
=over 4
=item B<ignoreCase TRUE|FALSE>
If B<TRUE>, returna regular expression withthe "i"modifier set, so that
case is ignored, whenmatching.
=item B<pathMode TRUE|FALSE>
Remove a possible leading exclamation mark from B<PATTERN> and mark the
regular expression in that case as negated. If a trailing slash could
be removed, the regular expression will be marked as a "directory match".
If B<PATTERN> contains more slashes, the regular expression is marked as
a "full path match".
Inner slashes are preserved. A leading slash is discarded, and only triggers
"full path match"mode.
See B<pnmatchstar()> above or the section L</"EXAMPLES"> below formore
details.
The option was intrucded in version 0.2.
=back
=item B<quotestar STRING[, NEGATABLE]>
Escapes all characters special to globstar patterns. They are:
=over 8
=item B<\\> the backslash
=item B<*> the asterisk/star
=item B<[> the opening square bracket
=item B<]> the closing square bracket (actually unneeded but ...)
=back
If the optional argument B<NEGATABLE> is a truthy value, a leading exclamation
mark will also be backslash-escaped.
=back
=head2 EXAMPLES
We start withsome examples forthe double asterisk pattern.
=over 4
=item B<**/*.css>
All files matching the name F<*.css> in the current directory and all its