| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
## no critic: Subroutines::ProhibitExplicitReturnUndef |
|
2
|
|
|
|
|
|
|
package File::MoreUtil; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
62571
|
use 5.010001; |
|
|
1
|
|
|
|
|
10
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
34
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use Cwd (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
20
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Exporter 'import'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1947
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
12
|
|
|
|
|
|
|
our $DATE = '2022-08-08'; # DATE |
|
13
|
|
|
|
|
|
|
our $DIST = 'File-MoreUtil'; # DIST |
|
14
|
|
|
|
|
|
|
our $VERSION = '0.626'; # VERSION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
17
|
|
|
|
|
|
|
file_exists |
|
18
|
|
|
|
|
|
|
l_abs_path |
|
19
|
|
|
|
|
|
|
dir_empty |
|
20
|
|
|
|
|
|
|
dir_not_empty |
|
21
|
|
|
|
|
|
|
dir_has_entries |
|
22
|
|
|
|
|
|
|
dir_has_files |
|
23
|
|
|
|
|
|
|
dir_has_dot_files |
|
24
|
|
|
|
|
|
|
dir_has_non_dot_files |
|
25
|
|
|
|
|
|
|
dir_has_subdirs |
|
26
|
|
|
|
|
|
|
dir_has_non_subdirs |
|
27
|
|
|
|
|
|
|
dir_has_dot_subdirs |
|
28
|
|
|
|
|
|
|
dir_has_non_dot_subdirs |
|
29
|
|
|
|
|
|
|
dir_only_has_files |
|
30
|
|
|
|
|
|
|
dir_only_has_dot_files |
|
31
|
|
|
|
|
|
|
dir_only_has_non_dot_files |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
get_dir_entries |
|
34
|
|
|
|
|
|
|
get_dir_dot_entries |
|
35
|
|
|
|
|
|
|
get_dir_subdirs |
|
36
|
|
|
|
|
|
|
get_dir_non_subdirs |
|
37
|
|
|
|
|
|
|
get_dir_dot_subdirs |
|
38
|
|
|
|
|
|
|
get_dir_non_dot_subdirs |
|
39
|
|
|
|
|
|
|
get_dir_files |
|
40
|
|
|
|
|
|
|
get_dir_dot_files |
|
41
|
|
|
|
|
|
|
get_dir_non_dot_files |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our %SPEC; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub file_exists { |
|
47
|
4
|
|
|
4
|
1
|
1451
|
my $path = shift; |
|
48
|
|
|
|
|
|
|
|
|
49
|
4
|
100
|
100
|
|
|
68
|
!(-l $path) && (-e _) || (-l _); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub l_abs_path { |
|
53
|
5
|
|
|
5
|
1
|
2600
|
my $path = shift; |
|
54
|
5
|
100
|
|
|
|
82
|
return Cwd::abs_path($path) unless (-l $path); |
|
55
|
|
|
|
|
|
|
|
|
56
|
4
|
|
|
|
|
20
|
$path =~ s!/\z!!; |
|
57
|
4
|
|
|
|
|
5
|
my ($parent, $leaf); |
|
58
|
4
|
50
|
|
|
|
23
|
if ($path =~ m!(.+)/(.+)!s) { |
|
59
|
4
|
|
|
|
|
50
|
$parent = Cwd::abs_path($1); |
|
60
|
4
|
50
|
|
|
|
12
|
return undef unless defined($path); |
|
61
|
4
|
|
|
|
|
8
|
$leaf = $2; |
|
62
|
|
|
|
|
|
|
} else { |
|
63
|
0
|
|
|
|
|
0
|
$parent = Cwd::getcwd(); |
|
64
|
0
|
|
|
|
|
0
|
$leaf = $path; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
4
|
|
|
|
|
22
|
"$parent/$leaf"; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub dir_empty { |
|
70
|
8
|
|
|
8
|
1
|
5662
|
my ($dir) = @_; |
|
71
|
8
|
100
|
|
|
|
88
|
return undef unless (-d $dir); |
|
72
|
7
|
50
|
|
|
|
145
|
return undef unless opendir my($dh), $dir; |
|
73
|
7
|
|
|
|
|
96
|
while (defined(my $e = readdir $dh)) { |
|
74
|
18
|
100
|
100
|
|
|
70
|
next if $e eq '.' || $e eq '..'; |
|
75
|
6
|
|
|
|
|
76
|
return 0; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
1
|
|
|
|
|
16
|
1; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub dir_not_empty { |
|
81
|
10
|
|
|
10
|
1
|
17
|
my ($dir) = @_; |
|
82
|
10
|
100
|
|
|
|
104
|
return undef unless (-d $dir); |
|
83
|
8
|
50
|
|
|
|
169
|
return undef unless opendir my($dh), $dir; |
|
84
|
8
|
|
|
|
|
102
|
while (defined(my $e = readdir $dh)) { |
|
85
|
18
|
100
|
100
|
|
|
73
|
next if $e eq '.' || $e eq '..'; |
|
86
|
6
|
|
|
|
|
73
|
return 1; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
2
|
|
|
|
|
29
|
0; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
5
|
|
|
5
|
1
|
14
|
sub dir_has_entries { goto \&dir_not_empty } |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub dir_has_files { |
|
94
|
11
|
|
|
11
|
1
|
18
|
my ($dir) = @_; |
|
95
|
11
|
100
|
|
|
|
119
|
return undef unless (-d $dir); |
|
96
|
10
|
50
|
|
|
|
192
|
return undef unless opendir my($dh), $dir; |
|
97
|
10
|
|
|
|
|
118
|
while (defined(my $e = readdir $dh)) { |
|
98
|
23
|
100
|
100
|
|
|
94
|
next if $e eq '.' || $e eq '..'; |
|
99
|
9
|
100
|
|
|
|
110
|
next unless -f "$dir/$e"; |
|
100
|
5
|
|
|
|
|
65
|
return 1; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
5
|
|
|
|
|
61
|
0; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub dir_only_has_files { |
|
106
|
8
|
|
|
8
|
1
|
14
|
my ($dir) = @_; |
|
107
|
8
|
100
|
|
|
|
93
|
return undef unless (-d $dir); |
|
108
|
7
|
50
|
|
|
|
133
|
return undef unless opendir my($dh), $dir; |
|
109
|
7
|
|
|
|
|
15
|
my $has_files; |
|
110
|
7
|
|
|
|
|
75
|
while (defined(my $e = readdir $dh)) { |
|
111
|
17
|
100
|
100
|
|
|
71
|
next if $e eq '.' || $e eq '..'; |
|
112
|
8
|
100
|
|
|
|
100
|
return 0 unless -f "$dir/$e"; |
|
113
|
5
|
|
|
|
|
26
|
$has_files++; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
4
|
100
|
|
|
|
62
|
$has_files ? 1:0; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub dir_has_dot_files { |
|
119
|
11
|
|
|
11
|
1
|
18
|
my ($dir) = @_; |
|
120
|
11
|
100
|
|
|
|
114
|
return undef unless (-d $dir); |
|
121
|
10
|
50
|
|
|
|
199
|
return undef unless opendir my($dh), $dir; |
|
122
|
10
|
|
|
|
|
112
|
while (defined(my $e = readdir $dh)) { |
|
123
|
28
|
100
|
100
|
|
|
128
|
next if $e eq '.' || $e eq '..'; |
|
124
|
10
|
100
|
|
|
|
50
|
next unless $e =~ /\A\./; |
|
125
|
4
|
100
|
|
|
|
45
|
next unless -f "$dir/$e"; |
|
126
|
3
|
|
|
|
|
40
|
return 1; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
7
|
|
|
|
|
94
|
0; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub dir_only_has_dot_files { |
|
132
|
7
|
|
|
7
|
1
|
13
|
my ($dir) = @_; |
|
133
|
7
|
100
|
|
|
|
72
|
return undef unless (-d $dir); |
|
134
|
6
|
50
|
|
|
|
109
|
return undef unless opendir my($dh), $dir; |
|
135
|
6
|
|
|
|
|
11
|
my $has_dot_files; |
|
136
|
6
|
|
|
|
|
61
|
while (defined(my $e = readdir $dh)) { |
|
137
|
10
|
100
|
100
|
|
|
42
|
next if $e eq '.' || $e eq '..'; |
|
138
|
5
|
100
|
|
|
|
48
|
return 0 unless $e =~ /\A\./; |
|
139
|
2
|
100
|
|
|
|
32
|
return 0 unless -f "$dir/$e"; |
|
140
|
1
|
|
|
|
|
8
|
$has_dot_files++; |
|
141
|
|
|
|
|
|
|
} |
|
142
|
2
|
100
|
|
|
|
37
|
$has_dot_files ? 1:0; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub dir_has_non_dot_files { |
|
146
|
11
|
|
|
11
|
1
|
19
|
my ($dir) = @_; |
|
147
|
11
|
100
|
|
|
|
114
|
return undef unless (-d $dir); |
|
148
|
10
|
50
|
|
|
|
195
|
return undef unless opendir my($dh), $dir; |
|
149
|
10
|
|
|
|
|
117
|
while (defined(my $e = readdir $dh)) { |
|
150
|
25
|
100
|
100
|
|
|
110
|
next if $e eq '.' || $e eq '..'; |
|
151
|
9
|
100
|
|
|
|
32
|
next if $e =~ /\A\./; |
|
152
|
6
|
100
|
|
|
|
75
|
next unless -f "$dir/$e"; |
|
153
|
3
|
|
|
|
|
40
|
return 1; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
7
|
|
|
|
|
100
|
0; |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub dir_only_has_non_dot_files { |
|
159
|
7
|
|
|
7
|
1
|
13
|
my ($dir) = @_; |
|
160
|
7
|
100
|
|
|
|
89
|
return undef unless (-d $dir); |
|
161
|
6
|
50
|
|
|
|
117
|
return undef unless opendir my($dh), $dir; |
|
162
|
6
|
|
|
|
|
19
|
my $has_nondot_files; |
|
163
|
6
|
|
|
|
|
62
|
while (defined(my $e = readdir $dh)) { |
|
164
|
15
|
100
|
100
|
|
|
62
|
next if $e eq '.' || $e eq '..'; |
|
165
|
6
|
100
|
|
|
|
49
|
return 0 if $e =~ /\A\./; |
|
166
|
3
|
100
|
|
|
|
40
|
return 0 unless -f "$dir/$e"; |
|
167
|
2
|
|
|
|
|
8
|
$has_nondot_files++; |
|
168
|
|
|
|
|
|
|
} |
|
169
|
2
|
100
|
|
|
|
33
|
$has_nondot_files ? 1:0; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub dir_has_subdirs { |
|
173
|
12
|
|
|
12
|
1
|
20
|
my ($dir) = @_; |
|
174
|
12
|
100
|
|
|
|
124
|
return undef unless (-d $dir); |
|
175
|
11
|
50
|
|
|
|
205
|
return undef unless opendir my($dh), $dir; |
|
176
|
11
|
|
|
|
|
128
|
while (defined(my $e = readdir $dh)) { |
|
177
|
29
|
100
|
100
|
|
|
105
|
next if $e eq '.' || $e eq '..'; |
|
178
|
10
|
100
|
|
|
|
114
|
next if -l "$dir/$e"; |
|
179
|
4
|
100
|
|
|
|
18
|
next unless -d _; |
|
180
|
2
|
|
|
|
|
25
|
return 1; |
|
181
|
|
|
|
|
|
|
} |
|
182
|
9
|
|
|
|
|
109
|
0; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub dir_has_non_subdirs { |
|
186
|
9
|
|
|
9
|
1
|
12
|
my ($dir) = @_; |
|
187
|
9
|
100
|
|
|
|
94
|
return undef unless (-d $dir); |
|
188
|
8
|
50
|
|
|
|
145
|
return undef unless opendir my($dh), $dir; |
|
189
|
8
|
|
|
|
|
90
|
while (defined(my $e = readdir $dh)) { |
|
190
|
21
|
100
|
100
|
|
|
83
|
next if $e eq '.' || $e eq '..'; |
|
191
|
7
|
100
|
|
|
|
95
|
return 1 if -l "$dir/$e"; |
|
192
|
4
|
100
|
|
|
|
36
|
return 1 if !(-d _); |
|
193
|
|
|
|
|
|
|
} |
|
194
|
3
|
|
|
|
|
36
|
0; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub dir_has_dot_subdirs { |
|
198
|
6
|
|
|
6
|
1
|
8
|
my ($dir) = @_; |
|
199
|
6
|
100
|
|
|
|
63
|
return undef unless (-d $dir); |
|
200
|
5
|
50
|
|
|
|
106
|
return undef unless opendir my($dh), $dir; |
|
201
|
5
|
|
|
|
|
55
|
while (defined(my $e = readdir $dh)) { |
|
202
|
13
|
100
|
100
|
|
|
56
|
next if $e eq '.' || $e eq '..'; |
|
203
|
4
|
100
|
|
|
|
18
|
next unless $e =~ /\A\./; |
|
204
|
2
|
50
|
|
|
|
19
|
next if -l "$dir/$e"; |
|
205
|
2
|
100
|
|
|
|
13
|
next unless -d _; |
|
206
|
1
|
|
|
|
|
13
|
return 1; |
|
207
|
|
|
|
|
|
|
} |
|
208
|
4
|
|
|
|
|
55
|
0; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub dir_has_non_dot_subdirs { |
|
212
|
6
|
|
|
6
|
1
|
8
|
my ($dir) = @_; |
|
213
|
6
|
100
|
|
|
|
64
|
return undef unless (-d $dir); |
|
214
|
5
|
50
|
|
|
|
103
|
return undef unless opendir my($dh), $dir; |
|
215
|
5
|
|
|
|
|
56
|
while (defined(my $e = readdir $dh)) { |
|
216
|
12
|
100
|
100
|
|
|
64
|
next if $e eq '.' || $e eq '..'; |
|
217
|
4
|
100
|
|
|
|
19
|
next if $e =~ /\A\./; |
|
218
|
2
|
50
|
|
|
|
19
|
next if -l "$dir/$e"; |
|
219
|
2
|
100
|
|
|
|
7
|
next unless -d _; |
|
220
|
1
|
|
|
|
|
14
|
return 1; |
|
221
|
|
|
|
|
|
|
} |
|
222
|
4
|
|
|
|
|
50
|
0; |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub get_dir_entries { |
|
226
|
2
|
|
|
2
|
1
|
2388
|
my ($dir) = @_; |
|
227
|
2
|
|
100
|
|
|
10
|
$dir //= "."; |
|
228
|
2
|
50
|
|
|
|
60
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
229
|
2
|
100
|
|
|
|
32
|
my @res = grep { $_ ne '.' && $_ ne '..' } readdir $dh; |
|
|
9
|
|
|
|
|
30
|
|
|
230
|
2
|
|
|
|
|
14
|
closedir $dh; # we're so nice |
|
231
|
2
|
|
|
|
|
22
|
@res; |
|
232
|
|
|
|
|
|
|
} |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub get_dir_dot_entries { |
|
235
|
1
|
|
|
1
|
1
|
2
|
my ($dir) = @_; |
|
236
|
1
|
|
50
|
|
|
5
|
$dir //= "."; |
|
237
|
1
|
50
|
|
|
|
21
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
238
|
1
|
100
|
100
|
|
|
18
|
my @res = grep { $_ ne '.' && $_ ne '..' && /\A\./ } readdir $dh; |
|
|
6
|
|
|
|
|
27
|
|
|
239
|
1
|
|
|
|
|
8
|
closedir $dh; # we're so nice |
|
240
|
1
|
|
|
|
|
10
|
@res; |
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub get_dir_files { |
|
244
|
1
|
|
|
1
|
1
|
2
|
my ($dir) = @_; |
|
245
|
1
|
|
50
|
|
|
5
|
$dir //= "."; |
|
246
|
1
|
50
|
|
|
|
23
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
247
|
1
|
100
|
100
|
|
|
17
|
my @res = grep { $_ ne '.' && $_ ne '..' && -f } readdir $dh; |
|
|
6
|
|
|
|
|
52
|
|
|
248
|
1
|
|
|
|
|
9
|
closedir $dh; # we're so nice |
|
249
|
1
|
|
|
|
|
10
|
@res; |
|
250
|
|
|
|
|
|
|
} |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub get_dir_dot_files { |
|
253
|
1
|
|
|
1
|
1
|
2
|
my ($dir) = @_; |
|
254
|
1
|
|
50
|
|
|
5
|
$dir //= "."; |
|
255
|
1
|
50
|
|
|
|
22
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
256
|
1
|
100
|
100
|
|
|
18
|
my @res = grep { $_ ne '.' && $_ ne '..' && /\A\./ && -f } readdir $dh; |
|
|
6
|
|
100
|
|
|
46
|
|
|
257
|
1
|
|
|
|
|
8
|
closedir $dh; # we're so nice |
|
258
|
1
|
|
|
|
|
9
|
@res; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub get_dir_non_dot_files { |
|
262
|
1
|
|
|
1
|
1
|
2
|
my ($dir) = @_; |
|
263
|
1
|
|
50
|
|
|
6
|
$dir //= "."; |
|
264
|
1
|
50
|
|
|
|
21
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
265
|
1
|
100
|
100
|
|
|
36
|
my @res = grep { $_ ne '.' && $_ ne '..' && !/\A\./ && -f } readdir $dh; |
|
|
6
|
|
100
|
|
|
49
|
|
|
266
|
1
|
|
|
|
|
9
|
closedir $dh; # we're so nice |
|
267
|
1
|
|
|
|
|
9
|
@res; |
|
268
|
|
|
|
|
|
|
} |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub get_dir_subdirs { |
|
271
|
2
|
|
|
2
|
1
|
4
|
my ($dir) = @_; |
|
272
|
2
|
|
100
|
|
|
8
|
$dir //= "."; |
|
273
|
2
|
50
|
|
|
|
40
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
274
|
2
|
100
|
100
|
|
|
33
|
my @res = grep { $_ ne '.' && $_ ne '..' && !(-l) && (-d _) } readdir $dh; |
|
|
9
|
|
66
|
|
|
79
|
|
|
275
|
2
|
|
|
|
|
16
|
closedir $dh; # we're so nice |
|
276
|
2
|
|
|
|
|
18
|
@res; |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub get_dir_non_subdirs { |
|
280
|
2
|
|
|
2
|
1
|
3
|
my ($dir) = @_; |
|
281
|
2
|
|
100
|
|
|
7
|
$dir //= "."; |
|
282
|
2
|
50
|
|
|
|
41
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
283
|
2
|
100
|
66
|
|
|
31
|
my @res = grep { $_ ne '.' && $_ ne '..' && ((-l) || !(-d _)) } readdir $dh; |
|
|
9
|
|
100
|
|
|
73
|
|
|
284
|
2
|
|
|
|
|
15
|
closedir $dh; # we're so nice |
|
285
|
2
|
|
|
|
|
18
|
@res; |
|
286
|
|
|
|
|
|
|
} |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
sub get_dir_dot_subdirs { |
|
289
|
1
|
|
|
1
|
1
|
2
|
my ($dir) = @_; |
|
290
|
1
|
|
50
|
|
|
11
|
$dir //= "."; |
|
291
|
1
|
50
|
|
|
|
21
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
292
|
1
|
100
|
100
|
|
|
24
|
my @res = grep { $_ ne '.' && $_ ne '..' && /\A\./ && !(-l) && (-d _) } readdir $dh; |
|
|
6
|
|
100
|
|
|
48
|
|
|
|
|
|
66
|
|
|
|
|
|
293
|
1
|
|
|
|
|
9
|
closedir $dh; # we're so nice |
|
294
|
1
|
|
|
|
|
8
|
@res; |
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub get_dir_non_dot_subdirs { |
|
298
|
1
|
|
|
1
|
1
|
3
|
my ($dir) = @_; |
|
299
|
1
|
|
50
|
|
|
4
|
$dir //= "."; |
|
300
|
1
|
50
|
|
|
|
21
|
opendir my($dh), $dir or die "Can't opendir $dir: $!"; |
|
301
|
1
|
100
|
100
|
|
|
17
|
my @res = grep { $_ ne '.' && $_ ne '..' && !/\A\./ && !(-l) && (-d _) } readdir $dh; |
|
|
6
|
|
100
|
|
|
47
|
|
|
|
|
|
66
|
|
|
|
|
|
302
|
1
|
|
|
|
|
9
|
closedir $dh; # we're so nice |
|
303
|
1
|
|
|
|
|
8
|
@res; |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
1; |
|
307
|
|
|
|
|
|
|
# ABSTRACT: File-related utilities |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
__END__ |