line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Regexp::Functions::chmod_et_al; |
2
|
2
|
|
|
2
|
|
47196
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
53
|
|
3
|
2
|
|
|
2
|
|
23
|
use 5.6.0; |
|
2
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
8
|
|
|
|
|
|
|
$qr_chmod_et_al |
9
|
|
|
|
|
|
|
); |
10
|
2
|
|
|
2
|
|
12
|
use Carp; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
968
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $qrstring = qr/[^,]+/; |
13
|
|
|
|
|
|
|
my $qrcomma = qr/\s*,\s*/; |
14
|
|
|
|
|
|
|
my $qrarrayref = qr/\[[^]]+\]/; |
15
|
|
|
|
|
|
|
my $qrfalse = qr/(?:0|''|"")/; |
16
|
|
|
|
|
|
|
my $qrfatarrow = qr/\s+=>\s+/; |
17
|
|
|
|
|
|
|
my $funcs = qr/mkdir/; |
18
|
|
|
|
|
|
|
my $qropenparen = qr/\s*\(\s*/; |
19
|
|
|
|
|
|
|
my $qrclosparen = qr/\s*\)\s*/; |
20
|
|
|
|
|
|
|
my $qrmf = qr/[0-7]/; |
21
|
|
|
|
|
|
|
my $qrmodes = qr/\b(?:20${qrmf}${qrmf}|02${qrmf}${qrmf}|00${qrmf}${qrmf}|0${qrmf}${qrmf}|2${qrmf}${qrmf}|00|0)\b/; |
22
|
|
|
|
|
|
|
my $qrspaceoropenparen = qr/(?:\s+|$qropenparen)/; |
23
|
|
|
|
|
|
|
my $qropenbrack = qr/\s*\[\s*/; |
24
|
|
|
|
|
|
|
my $qrclosbrack = qr/\s*\]\s*/; |
25
|
|
|
|
|
|
|
my $qropencurly = qr/\s*\{\s*/; |
26
|
|
|
|
|
|
|
my $qrcloscurly = qr/\s*\}\s*/; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# my $cnt = chmod 0755, "foo", "bar"; |
29
|
|
|
|
|
|
|
# mkdir FILENAME,MASK |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $qrmkdir = qr/ |
32
|
|
|
|
|
|
|
mkdir |
33
|
|
|
|
|
|
|
${qrspaceoropenparen} |
34
|
|
|
|
|
|
|
[^,]+ |
35
|
|
|
|
|
|
|
${qrcomma} |
36
|
|
|
|
|
|
|
${qrmodes} |
37
|
|
|
|
|
|
|
(?:$qrclosparen)? |
38
|
|
|
|
|
|
|
/x; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $qrchmod = qr/ |
41
|
|
|
|
|
|
|
chmod |
42
|
|
|
|
|
|
|
${qrspaceoropenparen} |
43
|
|
|
|
|
|
|
${qrmodes} |
44
|
|
|
|
|
|
|
${qrcomma} |
45
|
|
|
|
|
|
|
[^,]+ |
46
|
|
|
|
|
|
|
(?:,[^,]+)* |
47
|
|
|
|
|
|
|
(?:$qrclosparen)? |
48
|
|
|
|
|
|
|
/x; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $qrmkpath = qr/ |
51
|
|
|
|
|
|
|
mkpath |
52
|
|
|
|
|
|
|
${qrspaceoropenparen} |
53
|
|
|
|
|
|
|
[^,]+ |
54
|
|
|
|
|
|
|
${qrcomma} |
55
|
|
|
|
|
|
|
[01] |
56
|
|
|
|
|
|
|
${qrcomma} |
57
|
|
|
|
|
|
|
${qrmodes} |
58
|
|
|
|
|
|
|
(?:$qrclosparen)? |
59
|
|
|
|
|
|
|
/x; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $qrmkpath2 = qr/ |
62
|
|
|
|
|
|
|
mkpath |
63
|
|
|
|
|
|
|
${qrspaceoropenparen} |
64
|
|
|
|
|
|
|
${qropenbrack} |
65
|
|
|
|
|
|
|
[^,]+ |
66
|
|
|
|
|
|
|
(?:,[^,]+)* |
67
|
|
|
|
|
|
|
${qrclosbrack} |
68
|
|
|
|
|
|
|
${qrcomma} |
69
|
|
|
|
|
|
|
[01] |
70
|
|
|
|
|
|
|
${qrcomma} |
71
|
|
|
|
|
|
|
${qrmodes} |
72
|
|
|
|
|
|
|
(?:$qrclosparen)? |
73
|
|
|
|
|
|
|
/x; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
make_path('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 }); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
q|make_path($somedir, { verbose => 1, mode => 0000 })|, |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $qrmakepath = qr/ |
84
|
|
|
|
|
|
|
make_path |
85
|
|
|
|
|
|
|
${qrspaceoropenparen} |
86
|
|
|
|
|
|
|
[^,]+ |
87
|
|
|
|
|
|
|
(?:,[^,]+)* |
88
|
|
|
|
|
|
|
${qrcomma} |
89
|
|
|
|
|
|
|
${qropencurly} |
90
|
|
|
|
|
|
|
(?:[^,]+${qrcomma})* |
91
|
|
|
|
|
|
|
mode${qrfatarrow}${qrmodes} |
92
|
|
|
|
|
|
|
${qrcloscurly} |
93
|
|
|
|
|
|
|
(?:$qrclosparen)? |
94
|
|
|
|
|
|
|
/x; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
######################################## |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
our $qr_chmod_et_al; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$qr_chmod_et_al = qr/ |
101
|
|
|
|
|
|
|
( # This should be the only capture! |
102
|
|
|
|
|
|
|
${qrmkdir} # mkdir |
103
|
|
|
|
|
|
|
| |
104
|
|
|
|
|
|
|
${qrchmod} # chmod |
105
|
|
|
|
|
|
|
| |
106
|
|
|
|
|
|
|
${qrmkpath} # mkpath interface 1 |
107
|
|
|
|
|
|
|
| |
108
|
|
|
|
|
|
|
${qrmkpath2} # mkpath interface 2 |
109
|
|
|
|
|
|
|
| |
110
|
|
|
|
|
|
|
${qrmakepath} # make_path |
111
|
|
|
|
|
|
|
) |
112
|
|
|
|
|
|
|
/x; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 NAME |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Regexp::Functions::chmod_et_al - Patterns for matching Perl functions chmod(), mkdir(), File::Path::mkpath(), File::Path::make_path() |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SYNOPSIS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
use Regexp::Functions::chmod_et_al qw( $qr_chmod_et_al ); |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
@captures = 'chmod 0000, $somedir' =~ $qr_chmod_et_al; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 DESCRIPTION |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This module exports on request only a single scalar, C<$qr_chmod_et_al>, which |
127
|
|
|
|
|
|
|
is a compiled regular expression. The regex has a B limited focus: |
128
|
|
|
|
|
|
|
Searching Perl source code for instances of the following functions: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=over 4 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * Perl built-in C |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * Perl built-in C |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * C |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * C |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
... and only in circumstances where a numerical mode that specifies that the |
143
|
|
|
|
|
|
|
user has neither C nor C is being supplied as an argument. |
144
|
|
|
|
|
|
|
Examples of such modes: |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
0000 |
147
|
|
|
|
|
|
|
000 |
148
|
|
|
|
|
|
|
00 |
149
|
|
|
|
|
|
|
0 |
150
|
|
|
|
|
|
|
0200 |
151
|
|
|
|
|
|
|
200 |
152
|
|
|
|
|
|
|
0222 |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
B This is alpha code. This is a developer's tool and is B |
155
|
|
|
|
|
|
|
intended be used in production code. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 BUGS |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
None known at this time. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
James E Keenan |
164
|
|
|
|
|
|
|
CPAN ID: JKEENAN |
165
|
|
|
|
|
|
|
jkeenan@cpan.org |
166
|
|
|
|
|
|
|
http://thenceforward.net/perl/modules/Regexp-Functions-chmod_et_al |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 COPYRIGHT |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This program is free software; you can redistribute |
171
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The full text of the license can be found in the |
174
|
|
|
|
|
|
|
LICENSE file included with this module. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 SEE ALSO |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
perl(1). |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
1; |
183
|
|
|
|
|
|
|
|