line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This is a copy of Text::Glob, modified to support "**/" |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
27
|
|
|
27
|
|
206
|
use warnings; |
|
27
|
|
|
|
|
53
|
|
|
27
|
|
|
|
|
705
|
|
6
|
27
|
|
|
27
|
|
117
|
|
|
27
|
|
|
|
|
57
|
|
|
27
|
|
|
|
|
996
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.81'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Exporter qw(import); |
10
|
27
|
|
|
27
|
|
148
|
|
|
27
|
|
|
|
|
50
|
|
|
27
|
|
|
|
|
1959
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( zglobs_to_regex zglob_to_regex ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $strict_leading_dot = 1; |
14
|
|
|
|
|
|
|
our $strict_wildcard_slash = 1; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use constant debug => 0; |
17
|
27
|
|
|
27
|
|
180
|
|
|
27
|
|
|
|
|
55
|
|
|
27
|
|
|
|
|
15900
|
|
18
|
|
|
|
|
|
|
my @globs = @_; |
19
|
|
|
|
|
|
|
return @globs |
20
|
132
|
|
|
132
|
0
|
5167
|
? do { |
21
|
|
|
|
|
|
|
my $re = join( '|', map { "(?:" . zglob_to_regex($_) . ")" } @globs ); |
22
|
132
|
100
|
|
|
|
1372
|
qr/$re/; |
23
|
61
|
|
|
|
|
139
|
} |
|
61
|
|
|
|
|
204
|
|
24
|
61
|
|
|
|
|
1878
|
: qr/(?!)/; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $glob = shift; |
28
|
|
|
|
|
|
|
my $regex = zglob_to_regex_string($glob); |
29
|
|
|
|
|
|
|
return qr/^$regex$/; |
30
|
64
|
|
|
64
|
0
|
6962
|
} |
31
|
64
|
|
|
|
|
187
|
|
32
|
64
|
|
|
|
|
1886
|
my $glob = shift; |
33
|
|
|
|
|
|
|
my ( $regex, $in_curlies, $escaping ); |
34
|
|
|
|
|
|
|
local $_; |
35
|
|
|
|
|
|
|
my $first_byte = 1; |
36
|
64
|
|
|
64
|
0
|
120
|
$glob =~ s/\*\*\//\cZ/g; # convert **/ to single character |
37
|
64
|
|
|
|
|
103
|
for ( $glob =~ m/(.)/gs ) { |
38
|
64
|
|
|
|
|
95
|
if ($first_byte) { |
39
|
64
|
|
|
|
|
100
|
if ($strict_leading_dot) { |
40
|
64
|
|
|
|
|
171
|
$regex .= '(?=[^\.])' unless $_ eq '.'; |
41
|
64
|
|
|
|
|
440
|
} |
42
|
400
|
100
|
|
|
|
594
|
$first_byte = 0; |
43
|
81
|
50
|
|
|
|
169
|
} |
44
|
81
|
50
|
|
|
|
243
|
if ( $_ eq '/' ) { |
45
|
|
|
|
|
|
|
$first_byte = 1; |
46
|
81
|
|
|
|
|
123
|
} |
47
|
|
|
|
|
|
|
if ( $_ eq '.' |
48
|
400
|
100
|
|
|
|
603
|
|| $_ eq '(' |
49
|
17
|
|
|
|
|
21
|
|| $_ eq ')' |
50
|
|
|
|
|
|
|
|| $_ eq '|' |
51
|
400
|
100
|
66
|
|
|
4217
|
|| $_ eq '+' |
|
|
100
|
66
|
|
|
|
|
|
|
100
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
52
|
|
|
|
|
|
|
|| $_ eq '^' |
53
|
|
|
|
|
|
|
|| $_ eq '$' |
54
|
|
|
|
|
|
|
|| $_ eq '@' |
55
|
|
|
|
|
|
|
|| $_ eq '%' ) { |
56
|
|
|
|
|
|
|
$regex .= "\\$_"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
elsif ( $_ eq "\cZ" ) { # handle **/ - if escaping, only escape first * |
59
|
|
|
|
|
|
|
$regex |
60
|
19
|
|
|
|
|
30
|
.= $escaping |
61
|
|
|
|
|
|
|
? ( "\\*" . ( $strict_wildcard_slash ? "[^/]*" : ".*" ) . "/" ) |
62
|
|
|
|
|
|
|
: ".*"; |
63
|
23
|
0
|
|
|
|
70
|
} |
|
|
50
|
|
|
|
|
|
64
|
|
|
|
|
|
|
elsif ( $_ eq '*' ) { |
65
|
|
|
|
|
|
|
$regex |
66
|
|
|
|
|
|
|
.= $escaping ? "\\*" |
67
|
|
|
|
|
|
|
: $strict_wildcard_slash ? "[^/]*" |
68
|
|
|
|
|
|
|
: ".*"; |
69
|
64
|
50
|
|
|
|
210
|
} |
|
|
50
|
|
|
|
|
|
70
|
|
|
|
|
|
|
elsif ( $_ eq '?' ) { |
71
|
|
|
|
|
|
|
$regex |
72
|
|
|
|
|
|
|
.= $escaping ? "\\?" |
73
|
|
|
|
|
|
|
: $strict_wildcard_slash ? "[^/]" |
74
|
|
|
|
|
|
|
: "."; |
75
|
0
|
0
|
|
|
|
0
|
} |
|
|
0
|
|
|
|
|
|
76
|
|
|
|
|
|
|
elsif ( $_ eq '{' ) { |
77
|
|
|
|
|
|
|
$regex .= $escaping ? "\\{" : "("; |
78
|
|
|
|
|
|
|
++$in_curlies unless $escaping; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
elsif ( $_ eq '}' && $in_curlies ) { |
81
|
0
|
0
|
|
|
|
0
|
$regex .= $escaping ? "}" : ")"; |
82
|
0
|
0
|
|
|
|
0
|
--$in_curlies unless $escaping; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
elsif ( $_ eq ',' && $in_curlies ) { |
85
|
0
|
0
|
|
|
|
0
|
$regex .= $escaping ? "," : "|"; |
86
|
0
|
0
|
|
|
|
0
|
} |
87
|
|
|
|
|
|
|
elsif ( $_ eq "\\" ) { |
88
|
|
|
|
|
|
|
if ($escaping) { |
89
|
0
|
0
|
|
|
|
0
|
$regex .= "\\\\"; |
90
|
|
|
|
|
|
|
$escaping = 0; |
91
|
|
|
|
|
|
|
} |
92
|
0
|
0
|
|
|
|
0
|
else { |
93
|
0
|
|
|
|
|
0
|
$escaping = 1; |
94
|
0
|
|
|
|
|
0
|
} |
95
|
|
|
|
|
|
|
next; |
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
0
|
else { |
98
|
|
|
|
|
|
|
$regex .= $_; |
99
|
0
|
|
|
|
|
0
|
$escaping = 0; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
$escaping = 0; |
102
|
294
|
|
|
|
|
350
|
} |
103
|
294
|
|
|
|
|
312
|
print "# $glob $regex\n" if debug; |
104
|
|
|
|
|
|
|
|
105
|
400
|
|
|
|
|
529
|
return $regex; |
106
|
|
|
|
|
|
|
} |
107
|
64
|
|
|
|
|
113
|
|
108
|
|
|
|
|
|
|
1; |
109
|
64
|
|
|
|
|
165
|
|
110
|
|
|
|
|
|
|
# ABSTRACT: Test::Glob hacked up to support "**/*" |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=pod |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=encoding UTF-8 |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 NAME |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Code::TidyAll::Util::Zglob - Test::Glob hacked up to support "**/*" |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 VERSION |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
version 0.81 |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 SUPPORT |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SOURCE |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 AUTHORS |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over 4 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Jonathan Swartz <swartz@pobox.com> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This software is copyright (c) 2011 - 2022 by Jonathan Swartz. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
152
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
The full text of the license can be found in the |
155
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |