line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::perlfind::Plugin::Perlvar; |
2
|
10
|
|
|
10
|
|
1551549
|
use strict; |
|
10
|
|
|
|
|
29
|
|
|
10
|
|
|
|
|
426
|
|
3
|
10
|
|
|
10
|
|
43
|
use warnings; |
|
10
|
|
|
|
|
24
|
|
|
10
|
|
|
|
|
313
|
|
4
|
10
|
|
|
10
|
|
798
|
use App::perlfind; |
|
10
|
|
|
|
|
15
|
|
|
10
|
|
|
|
|
1088
|
|
5
|
|
|
|
|
|
|
our $VERSION = '2.07'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Generate %is_var with "util/perlvar-extract.pl". The value is what |
8
|
|
|
|
|
|
|
# the query key gets rewritten as. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# TODO generate this hash at runtime just like perlvar-extract does. |
11
|
|
|
|
|
|
|
# Needs to find perlvar.pod; at the moment I use "perldoc -l perlvar" |
12
|
|
|
|
|
|
|
# for that, but it seems bad to call perldoc more or less within |
13
|
|
|
|
|
|
|
# itself. Pod::Perldoc doesn't provide a method just to find the POD |
14
|
|
|
|
|
|
|
# file, though. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %is_var = ( |
17
|
|
|
|
|
|
|
'%+' => '%+', |
18
|
|
|
|
|
|
|
'INPUT_LINE_NUMBER' => '$INPUT_LINE_NUMBER', |
19
|
|
|
|
|
|
|
'$ERRNO' => '$ERRNO', |
20
|
|
|
|
|
|
|
'$OSNAME' => '$OSNAME', |
21
|
|
|
|
|
|
|
'$b' => '$b', |
22
|
|
|
|
|
|
|
'ERRNO' => '%ERRNO', |
23
|
|
|
|
|
|
|
'SIG' => '%SIG', |
24
|
|
|
|
|
|
|
'$OUTPUT_FIELD_SEPARATOR' => '$OUTPUT_FIELD_SEPARATOR', |
25
|
|
|
|
|
|
|
'@_' => '@_', |
26
|
|
|
|
|
|
|
'UNICODE' => '${^UNICODE}', |
27
|
|
|
|
|
|
|
'LAST_SUBMATCH_RESULT' => '$LAST_SUBMATCH_RESULT', |
28
|
|
|
|
|
|
|
'$COMPILING' => '$COMPILING', |
29
|
|
|
|
|
|
|
'%ERRNO' => '%ERRNO', |
30
|
|
|
|
|
|
|
'$OUTPUT_RECORD_SEPARATOR' => '$OUTPUT_RECORD_SEPARATOR', |
31
|
|
|
|
|
|
|
'$FORMAT_NAME' => '$FORMAT_NAME', |
32
|
|
|
|
|
|
|
'${^RE_DEBUG_FLAGS}' => '${^RE_DEBUG_FLAGS}', |
33
|
|
|
|
|
|
|
'$EUID' => '$EUID', |
34
|
|
|
|
|
|
|
'OPEN' => '${^OPEN}', |
35
|
|
|
|
|
|
|
'EXECUTABLE_NAME' => '$EXECUTABLE_NAME', |
36
|
|
|
|
|
|
|
'EFFECTIVE_USER_ID' => '$EFFECTIVE_USER_ID', |
37
|
|
|
|
|
|
|
'$OS_ERROR' => '$OS_ERROR', |
38
|
|
|
|
|
|
|
'CHILD_ERROR_NATIVE' => '$^CHILD_ERROR_NATIVE', |
39
|
|
|
|
|
|
|
'ENCODING' => '${^ENCODING}', |
40
|
|
|
|
|
|
|
'$`' => '$`', |
41
|
|
|
|
|
|
|
'$~' => '$~', |
42
|
|
|
|
|
|
|
'$^T' => '$^T', |
43
|
|
|
|
|
|
|
'PROCESS_ID' => '$PROCESS_ID', |
44
|
|
|
|
|
|
|
'WARNING' => '$WARNING', |
45
|
|
|
|
|
|
|
'$EXCEPTIONS_BEING_CAUGHT' => '$EXCEPTIONS_BEING_CAUGHT', |
46
|
|
|
|
|
|
|
'$)' => '$)', |
47
|
|
|
|
|
|
|
'$2' => '$2', |
48
|
|
|
|
|
|
|
'$ORS' => '$ORS', |
49
|
|
|
|
|
|
|
'$^A' => '$^A', |
50
|
|
|
|
|
|
|
'LIST_SEPARATOR' => '$LIST_SEPARATOR', |
51
|
|
|
|
|
|
|
'${^UTF8CACHE}' => '${^UTF8CACHE}', |
52
|
|
|
|
|
|
|
'$OFS' => '$OFS', |
53
|
|
|
|
|
|
|
'%SIG' => '%SIG', |
54
|
|
|
|
|
|
|
'$EFFECTIVE_GROUP_ID' => '$EFFECTIVE_GROUP_ID', |
55
|
|
|
|
|
|
|
'$ARGV' => '$ARGV', |
56
|
|
|
|
|
|
|
'$^O' => '$^O', |
57
|
|
|
|
|
|
|
'DEBUGGING' => '$DEBUGGING', |
58
|
|
|
|
|
|
|
'EGID' => '$EGID', |
59
|
|
|
|
|
|
|
'MATCH' => '${^MATCH}', |
60
|
|
|
|
|
|
|
'$GID' => '$GID', |
61
|
|
|
|
|
|
|
'TAINT' => '${^TAINT}', |
62
|
|
|
|
|
|
|
'$MATCH' => '$MATCH', |
63
|
|
|
|
|
|
|
'${^WARNING_BITS}' => '${^WARNING_BITS}', |
64
|
|
|
|
|
|
|
'$^W' => '$^W', |
65
|
|
|
|
|
|
|
'$^E' => '$^E', |
66
|
|
|
|
|
|
|
'${^GLOBAL_PHASE}' => '${^GLOBAL_PHASE}', |
67
|
|
|
|
|
|
|
'PERLDB' => '$PERLDB', |
68
|
|
|
|
|
|
|
'$ARG' => '$ARG', |
69
|
|
|
|
|
|
|
'$:' => '$:', |
70
|
|
|
|
|
|
|
'$+' => '$+', |
71
|
|
|
|
|
|
|
'$RS' => '$RS', |
72
|
|
|
|
|
|
|
'UID' => '$UID', |
73
|
|
|
|
|
|
|
'@LAST_MATCH_START' => '@LAST_MATCH_START', |
74
|
|
|
|
|
|
|
'FORMAT_LINES_LEFT' => '$FORMAT_LINES_LEFT', |
75
|
|
|
|
|
|
|
'PERL_VERSION' => '$PERL_VERSION', |
76
|
|
|
|
|
|
|
'$/' => '$/', |
77
|
|
|
|
|
|
|
'2' => '$2', |
78
|
|
|
|
|
|
|
'$LAST_SUBMATCH_RESULT' => '$LAST_SUBMATCH_RESULT', |
79
|
|
|
|
|
|
|
'NR' => '$NR', |
80
|
|
|
|
|
|
|
'OUTPUT_FIELD_SEPARATOR' => '$OUTPUT_FIELD_SEPARATOR', |
81
|
|
|
|
|
|
|
'${^RE_TRIE_MAXBUF}' => '${^RE_TRIE_MAXBUF}', |
82
|
|
|
|
|
|
|
'$0' => '$0', |
83
|
|
|
|
|
|
|
'RE_TRIE_MAXBUF' => '${^RE_TRIE_MAXBUF}', |
84
|
|
|
|
|
|
|
'$^X' => '$^X', |
85
|
|
|
|
|
|
|
'OFS' => '$OFS', |
86
|
|
|
|
|
|
|
'$WARNING' => '$WARNING', |
87
|
|
|
|
|
|
|
'FORMAT_NAME' => '$FORMAT_NAME', |
88
|
|
|
|
|
|
|
'$=' => '$=', |
89
|
|
|
|
|
|
|
'ARGV' => '@ARGV', |
90
|
|
|
|
|
|
|
'INC' => '%INC', |
91
|
|
|
|
|
|
|
'${^UTF8LOCALE}' => '${^UTF8LOCALE}', |
92
|
|
|
|
|
|
|
'@INC' => '@INC', |
93
|
|
|
|
|
|
|
'${^PREMATCH}' => '${^PREMATCH}', |
94
|
|
|
|
|
|
|
'$FORMAT_FORMFEED' => '$FORMAT_FORMFEED', |
95
|
|
|
|
|
|
|
'$PERL_VERSION' => '$PERL_VERSION', |
96
|
|
|
|
|
|
|
'$[' => '$[', |
97
|
|
|
|
|
|
|
'$CHILD_ERROR' => '$CHILD_ERROR', |
98
|
|
|
|
|
|
|
'%-' => '%-', |
99
|
|
|
|
|
|
|
'$$' => '$$', |
100
|
|
|
|
|
|
|
'$FORMAT_TOP_NAME' => '$FORMAT_TOP_NAME', |
101
|
|
|
|
|
|
|
'$^V' => '$^V', |
102
|
|
|
|
|
|
|
'$EVAL_ERROR' => '$EVAL_ERROR', |
103
|
|
|
|
|
|
|
'$-' => '$-', |
104
|
|
|
|
|
|
|
'$ACCUMULATOR' => '$ACCUMULATOR', |
105
|
|
|
|
|
|
|
'$^I' => '$^I', |
106
|
|
|
|
|
|
|
'$^R' => '$^R', |
107
|
|
|
|
|
|
|
'%ENV' => '%ENV', |
108
|
|
|
|
|
|
|
'$&' => '$&', |
109
|
|
|
|
|
|
|
'OUTPUT_RECORD_SEPARATOR' => '$OUTPUT_RECORD_SEPARATOR', |
110
|
|
|
|
|
|
|
'ARRAY_BASE' => '$ARRAY_BASE', |
111
|
|
|
|
|
|
|
'EXCEPTIONS_BEING_CAUGHT' => '$EXCEPTIONS_BEING_CAUGHT', |
112
|
|
|
|
|
|
|
'$]' => '$]', |
113
|
|
|
|
|
|
|
'$LAST_PAREN_MATCH' => '$LAST_PAREN_MATCH', |
114
|
|
|
|
|
|
|
'PROGRAM_NAME' => '$PROGRAM_NAME', |
115
|
|
|
|
|
|
|
'$BASETIME' => '$BASETIME', |
116
|
|
|
|
|
|
|
'0' => '$0', |
117
|
|
|
|
|
|
|
'$UID' => '$UID', |
118
|
|
|
|
|
|
|
'${^WIN32_SLOPPY_STAT}' => '${^WIN32_SLOPPY_STAT}', |
119
|
|
|
|
|
|
|
'$^P' => '$^P', |
120
|
|
|
|
|
|
|
'$^N' => '$^N', |
121
|
|
|
|
|
|
|
'FORMAT_PAGE_NUMBER' => '$FORMAT_PAGE_NUMBER', |
122
|
|
|
|
|
|
|
'OSNAME' => '$OSNAME', |
123
|
|
|
|
|
|
|
'ARG' => '@ARG', |
124
|
|
|
|
|
|
|
'8' => '$8', |
125
|
|
|
|
|
|
|
'LAST_MATCH_END' => '@LAST_MATCH_END', |
126
|
|
|
|
|
|
|
'%!' => '%!', |
127
|
|
|
|
|
|
|
'LAST_PAREN_MATCH' => '%LAST_PAREN_MATCH', |
128
|
|
|
|
|
|
|
'OS_ERROR' => '%OS_ERROR', |
129
|
|
|
|
|
|
|
'$"' => '$"', |
130
|
|
|
|
|
|
|
'$EFFECTIVE_USER_ID' => '$EFFECTIVE_USER_ID', |
131
|
|
|
|
|
|
|
'$_' => '$_', |
132
|
|
|
|
|
|
|
'5' => '$5', |
133
|
|
|
|
|
|
|
'SUBSEP' => '$SUBSEP', |
134
|
|
|
|
|
|
|
'7' => '$7', |
135
|
|
|
|
|
|
|
'$EXTENDED_OS_ERROR' => '$EXTENDED_OS_ERROR', |
136
|
|
|
|
|
|
|
'${^MATCH}' => '${^MATCH}', |
137
|
|
|
|
|
|
|
'$PREMATCH' => '$PREMATCH', |
138
|
|
|
|
|
|
|
'$OFMT' => '$OFMT', |
139
|
|
|
|
|
|
|
'GID' => '$GID', |
140
|
|
|
|
|
|
|
'$a' => '$a', |
141
|
|
|
|
|
|
|
'$*' => '$*', |
142
|
|
|
|
|
|
|
'$PID' => '$PID', |
143
|
|
|
|
|
|
|
'OUTPUT_AUTOFLUSH' => '$OUTPUT_AUTOFLUSH', |
144
|
|
|
|
|
|
|
'PREMATCH' => '$PREMATCH', |
145
|
|
|
|
|
|
|
'%LAST_PAREN_MATCH' => '%LAST_PAREN_MATCH', |
146
|
|
|
|
|
|
|
'$FORMAT_LINES_LEFT' => '$FORMAT_LINES_LEFT', |
147
|
|
|
|
|
|
|
'GLOBAL_PHASE' => '${^GLOBAL_PHASE}', |
148
|
|
|
|
|
|
|
'$EXECUTABLE_NAME' => '$EXECUTABLE_NAME', |
149
|
|
|
|
|
|
|
'$POSTMATCH' => '$POSTMATCH', |
150
|
|
|
|
|
|
|
'INPUT_RECORD_SEPARATOR' => '$INPUT_RECORD_SEPARATOR', |
151
|
|
|
|
|
|
|
'${^UNICODE}' => '${^UNICODE}', |
152
|
|
|
|
|
|
|
'$^CHILD_ERROR_NATIVE' => '$^CHILD_ERROR_NATIVE', |
153
|
|
|
|
|
|
|
'FORMAT_LINES_PER_PAGE' => '$FORMAT_LINES_PER_PAGE', |
154
|
|
|
|
|
|
|
'OFMT' => '$OFMT', |
155
|
|
|
|
|
|
|
'$FORMAT_LINES_PER_PAGE' => '$FORMAT_LINES_PER_PAGE', |
156
|
|
|
|
|
|
|
'FORMAT_TOP_NAME' => '$FORMAT_TOP_NAME', |
157
|
|
|
|
|
|
|
'$EGID' => '$EGID', |
158
|
|
|
|
|
|
|
'$OUTPUT_AUTOFLUSH' => '$OUTPUT_AUTOFLUSH', |
159
|
|
|
|
|
|
|
'$3' => '$3', |
160
|
|
|
|
|
|
|
'$REAL_GROUP_ID' => '$REAL_GROUP_ID', |
161
|
|
|
|
|
|
|
'$;' => '$;', |
162
|
|
|
|
|
|
|
'$^L' => '$^L', |
163
|
|
|
|
|
|
|
'OLD_PERL_VERSION' => '$OLD_PERL_VERSION', |
164
|
|
|
|
|
|
|
'$SYSTEM_FD_MAX' => '$SYSTEM_FD_MAX', |
165
|
|
|
|
|
|
|
'POSTMATCH' => '${^POSTMATCH}', |
166
|
|
|
|
|
|
|
'$INPUT_LINE_NUMBER' => '$INPUT_LINE_NUMBER', |
167
|
|
|
|
|
|
|
'_' => '$_', |
168
|
|
|
|
|
|
|
'@LAST_MATCH_END' => '@LAST_MATCH_END', |
169
|
|
|
|
|
|
|
'$^S' => '$^S', |
170
|
|
|
|
|
|
|
'$LAST_REGEXP_CODE_RESULT' => '$LAST_REGEXP_CODE_RESULT', |
171
|
|
|
|
|
|
|
'${^OPEN}' => '${^OPEN}', |
172
|
|
|
|
|
|
|
'$1' => '$1', |
173
|
|
|
|
|
|
|
'@-' => '@-', |
174
|
|
|
|
|
|
|
'EFFECTIVE_GROUP_ID' => '$EFFECTIVE_GROUP_ID', |
175
|
|
|
|
|
|
|
'$|' => '$|', |
176
|
|
|
|
|
|
|
'%OS_ERROR' => '%OS_ERROR', |
177
|
|
|
|
|
|
|
'$^H' => '$^H', |
178
|
|
|
|
|
|
|
'%^H' => '%^H', |
179
|
|
|
|
|
|
|
'$.' => '$.', |
180
|
|
|
|
|
|
|
'WIN32_SLOPPY_STAT' => '${^WIN32_SLOPPY_STAT}', |
181
|
|
|
|
|
|
|
'$^D' => '$^D', |
182
|
|
|
|
|
|
|
'1' => '$1', |
183
|
|
|
|
|
|
|
'RS' => '$RS', |
184
|
|
|
|
|
|
|
'%INC' => '%INC', |
185
|
|
|
|
|
|
|
'$LIST_SEPARATOR' => '$LIST_SEPARATOR', |
186
|
|
|
|
|
|
|
'WARNING_BITS' => '${^WARNING_BITS}', |
187
|
|
|
|
|
|
|
'$(' => '$(', |
188
|
|
|
|
|
|
|
'$#' => '$#', |
189
|
|
|
|
|
|
|
'$@' => '$@', |
190
|
|
|
|
|
|
|
'EXTENDED_OS_ERROR' => '$EXTENDED_OS_ERROR', |
191
|
|
|
|
|
|
|
'CHILD_ERROR' => '$CHILD_ERROR', |
192
|
|
|
|
|
|
|
'EUID' => '$EUID', |
193
|
|
|
|
|
|
|
'$,' => '$,', |
194
|
|
|
|
|
|
|
'ENV' => '%ENV', |
195
|
|
|
|
|
|
|
'$DEBUGGING' => '$DEBUGGING', |
196
|
|
|
|
|
|
|
'$INPUT_RECORD_SEPARATOR' => '$INPUT_RECORD_SEPARATOR', |
197
|
|
|
|
|
|
|
'$?' => '$?', |
198
|
|
|
|
|
|
|
'$REAL_USER_ID' => '$REAL_USER_ID', |
199
|
|
|
|
|
|
|
'$NR' => '$NR', |
200
|
|
|
|
|
|
|
'$^M' => '$^M', |
201
|
|
|
|
|
|
|
'${^TAINT}' => '${^TAINT}', |
202
|
|
|
|
|
|
|
'REAL_GROUP_ID' => '$REAL_GROUP_ID', |
203
|
|
|
|
|
|
|
'@ARGV' => '@ARGV', |
204
|
|
|
|
|
|
|
'LAST_REGEXP_CODE_RESULT' => '$LAST_REGEXP_CODE_RESULT', |
205
|
|
|
|
|
|
|
'UTF8CACHE' => '${^UTF8CACHE}', |
206
|
|
|
|
|
|
|
'FORMAT_FORMFEED' => '$FORMAT_FORMFEED', |
207
|
|
|
|
|
|
|
'ORS' => '$ORS', |
208
|
|
|
|
|
|
|
'$^F' => '$^F', |
209
|
|
|
|
|
|
|
'$%' => '$%', |
210
|
|
|
|
|
|
|
'$OLD_PERL_VERSION' => '$OLD_PERL_VERSION', |
211
|
|
|
|
|
|
|
'$ARRAY_BASE' => '$ARRAY_BASE', |
212
|
|
|
|
|
|
|
'${^POSTMATCH}' => '${^POSTMATCH}', |
213
|
|
|
|
|
|
|
'RE_DEBUG_FLAGS' => '${^RE_DEBUG_FLAGS}', |
214
|
|
|
|
|
|
|
'$SUBSEP' => '$SUBSEP', |
215
|
|
|
|
|
|
|
'$!' => '$!', |
216
|
|
|
|
|
|
|
'@ARG' => '@ARG', |
217
|
|
|
|
|
|
|
'$PROGRAM_NAME' => '$PROGRAM_NAME', |
218
|
|
|
|
|
|
|
'$FORMAT_PAGE_NUMBER' => '$FORMAT_PAGE_NUMBER', |
219
|
|
|
|
|
|
|
'6' => '$6', |
220
|
|
|
|
|
|
|
'PID' => '$PID', |
221
|
|
|
|
|
|
|
'$^C' => '$^C', |
222
|
|
|
|
|
|
|
'3' => '$3', |
223
|
|
|
|
|
|
|
'ACCUMULATOR' => '$ACCUMULATOR', |
224
|
|
|
|
|
|
|
'$INPLACE_EDIT' => '$INPLACE_EDIT', |
225
|
|
|
|
|
|
|
'@F' => '@F', |
226
|
|
|
|
|
|
|
'9' => '$9', |
227
|
|
|
|
|
|
|
'LAST_MATCH_START' => '%LAST_MATCH_START', |
228
|
|
|
|
|
|
|
'$\\' => '$\\', |
229
|
|
|
|
|
|
|
'${^ENCODING}' => '${^ENCODING}', |
230
|
|
|
|
|
|
|
'4' => '$4', |
231
|
|
|
|
|
|
|
'REAL_USER_ID' => '$REAL_USER_ID', |
232
|
|
|
|
|
|
|
'$^' => '$^', |
233
|
|
|
|
|
|
|
'BASETIME' => '$BASETIME', |
234
|
|
|
|
|
|
|
'COMPILING' => '$COMPILING', |
235
|
|
|
|
|
|
|
'@+' => '@+', |
236
|
|
|
|
|
|
|
'$PROCESS_ID' => '$PROCESS_ID', |
237
|
|
|
|
|
|
|
'$PERLDB' => '$PERLDB', |
238
|
|
|
|
|
|
|
'INPLACE_EDIT' => '$INPLACE_EDIT', |
239
|
|
|
|
|
|
|
'EVAL_ERROR' => '$EVAL_ERROR', |
240
|
|
|
|
|
|
|
'SYSTEM_FD_MAX' => '$SYSTEM_FD_MAX', |
241
|
|
|
|
|
|
|
'UTF8LOCALE' => '${^UTF8LOCALE}', |
242
|
|
|
|
|
|
|
'$\'' => '$\'', |
243
|
|
|
|
|
|
|
'%LAST_MATCH_START' => '%LAST_MATCH_START' |
244
|
|
|
|
|
|
|
); |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
# find __WARN__, INT etc. as %SIG. |
247
|
|
|
|
|
|
|
$is_var{$_} = '%SIG' for qw(__WARN__ __DIE__ INT QUIT PIPE), keys %SIG; |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
App::perlfind->add_trigger( |
250
|
|
|
|
|
|
|
'matches.add' => sub { |
251
|
|
|
|
|
|
|
my ($class, $word, $matches) = @_; |
252
|
|
|
|
|
|
|
if (my $rewrite = $is_var{$$word}) { |
253
|
|
|
|
|
|
|
$$word = $rewrite; |
254
|
|
|
|
|
|
|
push @$matches, 'perlvar'; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
); |
258
|
|
|
|
|
|
|
1; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
__END__ |