Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "B 3" | |
132 | .TH B 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | B \- The Perl Compiler | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | .Vb 1 | |
138 | \& use B; | |
139 | .Ve | |
140 | .SH "DESCRIPTION" | |
141 | .IX Header "DESCRIPTION" | |
142 | The \f(CW\*(C`B\*(C'\fR module supplies classes which allow a Perl program to delve | |
143 | into its own innards. It is the module used to implement the | |
144 | \&\*(L"backends\*(R" of the Perl compiler. Usage of the compiler does not | |
145 | require knowledge of this module: see the \fIO\fR module for the | |
146 | user-visible part. The \f(CW\*(C`B\*(C'\fR module is of use to those who want to | |
147 | write new compiler backends. This documentation assumes that the | |
148 | reader knows a fair amount about perl's internals including such | |
149 | things as SVs, OPs and the internal symbol table and syntax tree | |
150 | of a program. | |
151 | .SH "OVERVIEW" | |
152 | .IX Header "OVERVIEW" | |
153 | The \f(CW\*(C`B\*(C'\fR module contains a set of utility functions for querying the | |
154 | current state of the Perl interpreter; typically these functions | |
155 | return objects from the B::SV and B::OP classes, or their derived | |
156 | classes. These classes in turn define methods for querying the | |
157 | resulting objects about their own internal state. | |
158 | .SH "Utility Functions" | |
159 | .IX Header "Utility Functions" | |
160 | The \f(CW\*(C`B\*(C'\fR module exports a variety of functions: some are simple | |
161 | utility functions, others provide a Perl program with a way to | |
162 | get an initial \*(L"handle\*(R" on an internal object. | |
163 | .ie n .Sh "Functions Returning ""B::SV""\fP, \f(CW""B::AV""\fP, \f(CW""B::HV""\fP, and \f(CW""B::CV"" objects" | |
164 | .el .Sh "Functions Returning \f(CWB::SV\fP, \f(CWB::AV\fP, \f(CWB::HV\fP, and \f(CWB::CV\fP objects" | |
165 | .IX Subsection "Functions Returning B::SV, B::AV, B::HV, and B::CV objects" | |
166 | For descriptions of the class hierarchy of these objects and the | |
167 | methods that can be called on them, see below, \*(L"\s-1OVERVIEW\s0 \s-1OF\s0 \s-1CLASSES\s0\*(R" and \*(L"\s-1SV\-RELATED\s0 \s-1CLASSES\s0\*(R". | |
168 | .IP "sv_undef" 4 | |
169 | .IX Item "sv_undef" | |
170 | Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_undef\*(C'\fR. | |
171 | .IP "sv_yes" 4 | |
172 | .IX Item "sv_yes" | |
173 | Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_yes\*(C'\fR. | |
174 | .IP "sv_no" 4 | |
175 | .IX Item "sv_no" | |
176 | Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_no\*(C'\fR. | |
177 | .IP "svref_2object(\s-1SVREF\s0)" 4 | |
178 | .IX Item "svref_2object(SVREF)" | |
179 | Takes a reference to any Perl value, and turns the referred-to value | |
180 | into an object in the appropriate B::OP\-derived or B::SV\-derived | |
181 | class. Apart from functions such as \f(CW\*(C`main_root\*(C'\fR, this is the primary | |
182 | way to get an initial \*(L"handle\*(R" on an internal perl data structure | |
183 | which can then be followed with the other access methods. | |
184 | .Sp | |
185 | The returned object will only be valid as long as the underlying OPs | |
186 | and SVs continue to exist. Do not attempt to use the object after the | |
187 | underlying structures are freed. | |
188 | .IP "amagic_generation" 4 | |
189 | .IX Item "amagic_generation" | |
190 | Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`amagic_generation\*(C'\fR. | |
191 | .IP "init_av" 4 | |
192 | .IX Item "init_av" | |
193 | Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1INIT\s0 blocks. | |
194 | .IP "check_av" 4 | |
195 | .IX Item "check_av" | |
196 | Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1CHECK\s0 blocks. | |
197 | .IP "begin_av" 4 | |
198 | .IX Item "begin_av" | |
199 | Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1BEGIN\s0 blocks. | |
200 | .IP "end_av" 4 | |
201 | .IX Item "end_av" | |
202 | Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1END\s0 blocks. | |
203 | .IP "comppadlist" 4 | |
204 | .IX Item "comppadlist" | |
205 | Returns the \s-1AV\s0 object (i.e. in class B::AV) of the global comppadlist. | |
206 | .IP "regex_padav" 4 | |
207 | .IX Item "regex_padav" | |
208 | Only when perl was compiled with ithreads. | |
209 | .IP "main_cv" 4 | |
210 | .IX Item "main_cv" | |
211 | Return the (faked) \s-1CV\s0 corresponding to the main part of the Perl | |
212 | program. | |
213 | .Sh "Functions for Examining the Symbol Table" | |
214 | .IX Subsection "Functions for Examining the Symbol Table" | |
215 | .IP "walksymtable(\s-1SYMREF\s0, \s-1METHOD\s0, \s-1RECURSE\s0, \s-1PREFIX\s0)" 4 | |
216 | .IX Item "walksymtable(SYMREF, METHOD, RECURSE, PREFIX)" | |
217 | Walk the symbol table starting at \s-1SYMREF\s0 and call \s-1METHOD\s0 on each | |
218 | symbol (a B::GV object) visited. When the walk reaches package | |
219 | symbols (such as \*(L"Foo::\*(R") it invokes \s-1RECURSE\s0, passing in the symbol | |
220 | name, and only recurses into the package if that sub returns true. | |
221 | .Sp | |
222 | \&\s-1PREFIX\s0 is the name of the \s-1SYMREF\s0 you're walking. | |
223 | .Sp | |
224 | For example: | |
225 | .Sp | |
226 | .Vb 4 | |
227 | \& # Walk CGI's symbol table calling print_subs on each symbol. | |
228 | \& # Recurse only into CGI::Util:: | |
229 | \& walksymtable(\e%CGI::, 'print_subs', sub { $_[0] eq 'CGI::Util::' }, | |
230 | \& 'CGI::'); | |
231 | .Ve | |
232 | .Sp | |
233 | \&\fIprint_subs()\fR is a B::GV method you have declared. Also see \*(L"B::GV Methods\*(R", below. | |
234 | .ie n .Sh "Functions Returning ""B::OP"" objects or for walking op trees" | |
235 | .el .Sh "Functions Returning \f(CWB::OP\fP objects or for walking op trees" | |
236 | .IX Subsection "Functions Returning B::OP objects or for walking op trees" | |
237 | For descriptions of the class hierarchy of these objects and the | |
238 | methods that can be called on them, see below, \*(L"\s-1OVERVIEW\s0 \s-1OF\s0 \s-1CLASSES\s0\*(R" and \*(L"\s-1OP\-RELATED\s0 \s-1CLASSES\s0\*(R". | |
239 | .IP "main_root" 4 | |
240 | .IX Item "main_root" | |
241 | Returns the root op (i.e. an object in the appropriate B::OP\-derived | |
242 | class) of the main part of the Perl program. | |
243 | .IP "main_start" 4 | |
244 | .IX Item "main_start" | |
245 | Returns the starting op of the main part of the Perl program. | |
246 | .IP "walkoptree(\s-1OP\s0, \s-1METHOD\s0)" 4 | |
247 | .IX Item "walkoptree(OP, METHOD)" | |
248 | Does a tree-walk of the syntax tree based at \s-1OP\s0 and calls \s-1METHOD\s0 on | |
249 | each op it visits. Each node is visited before its children. If | |
250 | \&\f(CW\*(C`walkoptree_debug\*(C'\fR (see below) has been called to turn debugging on then | |
251 | the method \f(CW\*(C`walkoptree_debug\*(C'\fR is called on each op before \s-1METHOD\s0 is | |
252 | called. | |
253 | .IP "walkoptree_debug(\s-1DEBUG\s0)" 4 | |
254 | .IX Item "walkoptree_debug(DEBUG)" | |
255 | Returns the current debugging flag for \f(CW\*(C`walkoptree\*(C'\fR. If the optional | |
256 | \&\s-1DEBUG\s0 argument is non\-zero, it sets the debugging flag to that. See | |
257 | the description of \f(CW\*(C`walkoptree\*(C'\fR above for what the debugging flag | |
258 | does. | |
259 | .Sh "Miscellaneous Utility Functions" | |
260 | .IX Subsection "Miscellaneous Utility Functions" | |
261 | .IP "ppname(\s-1OPNUM\s0)" 4 | |
262 | .IX Item "ppname(OPNUM)" | |
263 | Return the \s-1PP\s0 function name (e.g. \*(L"pp_add\*(R") of op number \s-1OPNUM\s0. | |
264 | .IP "hash(\s-1STR\s0)" 4 | |
265 | .IX Item "hash(STR)" | |
266 | Returns a string in the form \*(L"0x...\*(R" representing the value of the | |
267 | internal hash function used by perl on string \s-1STR\s0. | |
268 | .IP "cast_I32(I)" 4 | |
269 | .IX Item "cast_I32(I)" | |
270 | Casts I to the internal I32 type used by that perl. | |
271 | .IP "minus_c" 4 | |
272 | .IX Item "minus_c" | |
273 | Does the equivalent of the \f(CW\*(C`\-c\*(C'\fR command-line option. Obviously, this | |
274 | is only useful in a \s-1BEGIN\s0 block or else the flag is set too late. | |
275 | .IP "cstring(\s-1STR\s0)" 4 | |
276 | .IX Item "cstring(STR)" | |
277 | Returns a double-quote-surrounded escaped version of \s-1STR\s0 which can | |
278 | be used as a string in C source code. | |
279 | .IP "perlstring(\s-1STR\s0)" 4 | |
280 | .IX Item "perlstring(STR)" | |
281 | Returns a double-quote-surrounded escaped version of \s-1STR\s0 which can | |
282 | be used as a string in Perl source code. | |
283 | .IP "class(\s-1OBJ\s0)" 4 | |
284 | .IX Item "class(OBJ)" | |
285 | Returns the class of an object without the part of the classname | |
286 | preceding the first \f(CW"::"\fR. This is used to turn \f(CW"B::UNOP"\fR into | |
287 | \&\f(CW"UNOP"\fR for example. | |
288 | .IP "threadsv_names" 4 | |
289 | .IX Item "threadsv_names" | |
290 | In a perl compiled for threads, this returns a list of the special | |
291 | per-thread threadsv variables. | |
292 | .SH "OVERVIEW OF CLASSES" | |
293 | .IX Header "OVERVIEW OF CLASSES" | |
294 | The C structures used by Perl's internals to hold \s-1SV\s0 and \s-1OP\s0 | |
295 | information (\s-1PVIV\s0, \s-1AV\s0, \s-1HV\s0, ..., \s-1OP\s0, \s-1SVOP\s0, \s-1UNOP\s0, ...) are modelled on a | |
296 | class hierarchy and the \f(CW\*(C`B\*(C'\fR module gives access to them via a true | |
297 | object hierarchy. Structure fields which point to other objects | |
298 | (whether types of \s-1SV\s0 or types of \s-1OP\s0) are represented by the \f(CW\*(C`B\*(C'\fR | |
299 | module as Perl objects of the appropriate class. | |
300 | .PP | |
301 | The bulk of the \f(CW\*(C`B\*(C'\fR module is the methods for accessing fields of | |
302 | these structures. | |
303 | .PP | |
304 | Note that all access is read\-only. You cannot modify the internals by | |
305 | using this module. Also, note that the B::OP and B::SV objects created | |
306 | by this module are only valid for as long as the underlying objects | |
307 | exist; their creation doesn't increase the reference counts of the | |
308 | underlying objects. Trying to access the fields of a freed object will | |
309 | give incomprehensible results, or worse. | |
310 | .Sh "SV-RELATED \s-1CLASSES\s0" | |
311 | .IX Subsection "SV-RELATED CLASSES" | |
312 | B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV, | |
313 | B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in | |
314 | the obvious way to the underlying C structures of similar names. The | |
315 | inheritance hierarchy mimics the underlying C \*(L"inheritance\*(R". For 5.9.1 | |
316 | and later this is: | |
317 | .PP | |
318 | .Vb 22 | |
319 | \& B::SV | |
320 | \& | | |
321 | \& +--------------+----------+------------+ | |
322 | \& | | | | | |
323 | \& B::PV B::IV B::NV B::RV | |
324 | \& \e / / | |
325 | \& \e / / | |
326 | \& B::PVIV / | |
327 | \& \e / | |
328 | \& \e / | |
329 | \& \e / | |
330 | \& B::PVNV | |
331 | \& | | |
332 | \& | | |
333 | \& B::PVMG | |
334 | \& | | |
335 | \& +-----+----+------+-----+-----+ | |
336 | \& | | | | | | | |
337 | \& B::BM B::AV B::GV B::HV B::CV B::IO | |
338 | \& | | | |
339 | \& B::PVLV | | |
340 | \& B::FM | |
341 | .Ve | |
342 | .PP | |
343 | For 5.9.0 and earlier, \s-1PVLV\s0 is a direct subclass of \s-1PVMG\s0, so the base | |
344 | of this diagram is | |
345 | .PP | |
346 | .Vb 9 | |
347 | \& | | |
348 | \& B::PVMG | |
349 | \& | | |
350 | \& +------+-----+----+------+-----+-----+ | |
351 | \& | | | | | | | | |
352 | \& B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO | |
353 | \& | | |
354 | \& | | |
355 | \& B::FM | |
356 | .Ve | |
357 | .PP | |
358 | Access methods correspond to the underlying C macros for field access, | |
359 | usually with the leading \*(L"class indication\*(R" prefix removed (Sv, Av, | |
360 | Hv, ...). The leading prefix is only left in cases where its removal | |
361 | would cause a clash in method name. For example, \f(CW\*(C`GvREFCNT\*(C'\fR stays | |
362 | as-is since its abbreviation would clash with the \*(L"superclass\*(R" method | |
363 | \&\f(CW\*(C`REFCNT\*(C'\fR (corresponding to the C function \f(CW\*(C`SvREFCNT\*(C'\fR). | |
364 | .Sh "B::SV Methods" | |
365 | .IX Subsection "B::SV Methods" | |
366 | .IP "\s-1REFCNT\s0" 4 | |
367 | .IX Item "REFCNT" | |
368 | .PD 0 | |
369 | .IP "\s-1FLAGS\s0" 4 | |
370 | .IX Item "FLAGS" | |
371 | .IP "object_2svref" 4 | |
372 | .IX Item "object_2svref" | |
373 | .PD | |
374 | Returns a reference to the regular scalar corresponding to this | |
375 | B::SV object. In other words, this method is the inverse operation | |
376 | to the \fIsvref_2object()\fR subroutine. This scalar and other data it points | |
377 | at should be considered read\-only: modifying them is neither safe nor | |
378 | guaranteed to have a sensible effect. | |
379 | .Sh "B::IV Methods" | |
380 | .IX Subsection "B::IV Methods" | |
381 | .IP "\s-1IV\s0" 4 | |
382 | .IX Item "IV" | |
383 | Returns the value of the \s-1IV\s0, \fIinterpreted as | |
384 | a signed integer\fR. This will be misleading | |
385 | if \f(CW\*(C`FLAGS & SVf_IVisUV\*(C'\fR. Perhaps you want the | |
386 | \&\f(CW\*(C`int_value\*(C'\fR method instead? | |
387 | .IP "\s-1IVX\s0" 4 | |
388 | .IX Item "IVX" | |
389 | .PD 0 | |
390 | .IP "\s-1UVX\s0" 4 | |
391 | .IX Item "UVX" | |
392 | .IP "int_value" 4 | |
393 | .IX Item "int_value" | |
394 | .PD | |
395 | This method returns the value of the \s-1IV\s0 as an integer. | |
396 | It differs from \f(CW\*(C`IV\*(C'\fR in that it returns the correct | |
397 | value regardless of whether it's stored signed or | |
398 | unsigned. | |
399 | .IP "needs64bits" 4 | |
400 | .IX Item "needs64bits" | |
401 | .PD 0 | |
402 | .IP "packiv" 4 | |
403 | .IX Item "packiv" | |
404 | .PD | |
405 | .Sh "B::NV Methods" | |
406 | .IX Subsection "B::NV Methods" | |
407 | .IP "\s-1NV\s0" 4 | |
408 | .IX Item "NV" | |
409 | .PD 0 | |
410 | .IP "\s-1NVX\s0" 4 | |
411 | .IX Item "NVX" | |
412 | .PD | |
413 | .Sh "B::RV Methods" | |
414 | .IX Subsection "B::RV Methods" | |
415 | .IP "\s-1RV\s0" 4 | |
416 | .IX Item "RV" | |
417 | .Sh "B::PV Methods" | |
418 | .IX Subsection "B::PV Methods" | |
419 | .PD 0 | |
420 | .IP "\s-1PV\s0" 4 | |
421 | .IX Item "PV" | |
422 | .PD | |
423 | This method is the one you usually want. It constructs a | |
424 | string using the length and offset information in the struct: | |
425 | for ordinary scalars it will return the string that you'd see | |
426 | from Perl, even if it contains null characters. | |
427 | .IP "\s-1RV\s0" 4 | |
428 | .IX Item "RV" | |
429 | Same as B::RV::RV, except that it will \fIdie()\fR if the \s-1PV\s0 isn't | |
430 | a reference. | |
431 | .IP "\s-1PVX\s0" 4 | |
432 | .IX Item "PVX" | |
433 | This method is less often useful. It assumes that the string | |
434 | stored in the struct is null\-terminated, and disregards the | |
435 | length information. | |
436 | .Sp | |
437 | It is the appropriate method to use if you need to get the name | |
438 | of a lexical variable from a padname array. Lexical variable names | |
439 | are always stored with a null terminator, and the length field | |
440 | (SvCUR) is overloaded for other purposes and can't be relied on here. | |
441 | .Sh "B::PVMG Methods" | |
442 | .IX Subsection "B::PVMG Methods" | |
443 | .IP "\s-1MAGIC\s0" 4 | |
444 | .IX Item "MAGIC" | |
445 | .PD 0 | |
446 | .IP "SvSTASH" 4 | |
447 | .IX Item "SvSTASH" | |
448 | .PD | |
449 | .Sh "B::MAGIC Methods" | |
450 | .IX Subsection "B::MAGIC Methods" | |
451 | .IP "\s-1MOREMAGIC\s0" 4 | |
452 | .IX Item "MOREMAGIC" | |
453 | .PD 0 | |
454 | .IP "precomp" 4 | |
455 | .IX Item "precomp" | |
456 | .PD | |
457 | Only valid on r\-magic, returns the string that generated the regexp. | |
458 | .IP "\s-1PRIVATE\s0" 4 | |
459 | .IX Item "PRIVATE" | |
460 | .PD 0 | |
461 | .IP "\s-1TYPE\s0" 4 | |
462 | .IX Item "TYPE" | |
463 | .IP "\s-1FLAGS\s0" 4 | |
464 | .IX Item "FLAGS" | |
465 | .IP "\s-1OBJ\s0" 4 | |
466 | .IX Item "OBJ" | |
467 | .PD | |
468 | Will \fIdie()\fR if called on r\-magic. | |
469 | .IP "\s-1PTR\s0" 4 | |
470 | .IX Item "PTR" | |
471 | .PD 0 | |
472 | .IP "\s-1REGEX\s0" 4 | |
473 | .IX Item "REGEX" | |
474 | .PD | |
475 | Only valid on r\-magic, returns the integer value of the \s-1REGEX\s0 stored | |
476 | in the \s-1MAGIC\s0. | |
477 | .Sh "B::PVLV Methods" | |
478 | .IX Subsection "B::PVLV Methods" | |
479 | .IP "\s-1TARGOFF\s0" 4 | |
480 | .IX Item "TARGOFF" | |
481 | .PD 0 | |
482 | .IP "\s-1TARGLEN\s0" 4 | |
483 | .IX Item "TARGLEN" | |
484 | .IP "\s-1TYPE\s0" 4 | |
485 | .IX Item "TYPE" | |
486 | .IP "\s-1TARG\s0" 4 | |
487 | .IX Item "TARG" | |
488 | .PD | |
489 | .Sh "B::BM Methods" | |
490 | .IX Subsection "B::BM Methods" | |
491 | .IP "\s-1USEFUL\s0" 4 | |
492 | .IX Item "USEFUL" | |
493 | .PD 0 | |
494 | .IP "\s-1PREVIOUS\s0" 4 | |
495 | .IX Item "PREVIOUS" | |
496 | .IP "\s-1RARE\s0" 4 | |
497 | .IX Item "RARE" | |
498 | .IP "\s-1TABLE\s0" 4 | |
499 | .IX Item "TABLE" | |
500 | .PD | |
501 | .Sh "B::GV Methods" | |
502 | .IX Subsection "B::GV Methods" | |
503 | .IP "is_empty" 4 | |
504 | .IX Item "is_empty" | |
505 | This method returns \s-1TRUE\s0 if the \s-1GP\s0 field of the \s-1GV\s0 is \s-1NULL\s0. | |
506 | .IP "\s-1NAME\s0" 4 | |
507 | .IX Item "NAME" | |
508 | .PD 0 | |
509 | .IP "\s-1SAFENAME\s0" 4 | |
510 | .IX Item "SAFENAME" | |
511 | .PD | |
512 | This method returns the name of the glob, but if the first | |
513 | character of the name is a control character, then it converts | |
514 | it to ^X first, so that *^G would return \*(L"^G\*(R" rather than \*(L"\ecG\*(R". | |
515 | .Sp | |
516 | It's useful if you want to print out the name of a variable. | |
517 | If you restrict yourself to globs which exist at compile-time | |
518 | then the result ought to be unambiguous, because code like | |
519 | \&\f(CW\*(C`${"^G"} = 1\*(C'\fR is compiled as two ops \- a constant string and | |
520 | a dereference (rv2gv) \- so that the glob is created at runtime. | |
521 | .Sp | |
522 | If you're working with globs at runtime, and need to disambiguate | |
523 | *^G from *{\*(L"^G\*(R"}, then you should use the raw \s-1NAME\s0 method. | |
524 | .IP "\s-1STASH\s0" 4 | |
525 | .IX Item "STASH" | |
526 | .PD 0 | |
527 | .IP "\s-1SV\s0" 4 | |
528 | .IX Item "SV" | |
529 | .IP "\s-1IO\s0" 4 | |
530 | .IX Item "IO" | |
531 | .IP "\s-1FORM\s0" 4 | |
532 | .IX Item "FORM" | |
533 | .IP "\s-1AV\s0" 4 | |
534 | .IX Item "AV" | |
535 | .IP "\s-1HV\s0" 4 | |
536 | .IX Item "HV" | |
537 | .IP "\s-1EGV\s0" 4 | |
538 | .IX Item "EGV" | |
539 | .IP "\s-1CV\s0" 4 | |
540 | .IX Item "CV" | |
541 | .IP "\s-1CVGEN\s0" 4 | |
542 | .IX Item "CVGEN" | |
543 | .IP "\s-1LINE\s0" 4 | |
544 | .IX Item "LINE" | |
545 | .IP "\s-1FILE\s0" 4 | |
546 | .IX Item "FILE" | |
547 | .IP "\s-1FILEGV\s0" 4 | |
548 | .IX Item "FILEGV" | |
549 | .IP "GvREFCNT" 4 | |
550 | .IX Item "GvREFCNT" | |
551 | .IP "\s-1FLAGS\s0" 4 | |
552 | .IX Item "FLAGS" | |
553 | .PD | |
554 | .Sh "B::IO Methods" | |
555 | .IX Subsection "B::IO Methods" | |
556 | .IP "\s-1LINES\s0" 4 | |
557 | .IX Item "LINES" | |
558 | .PD 0 | |
559 | .IP "\s-1PAGE\s0" 4 | |
560 | .IX Item "PAGE" | |
561 | .IP "\s-1PAGE_LEN\s0" 4 | |
562 | .IX Item "PAGE_LEN" | |
563 | .IP "\s-1LINES_LEFT\s0" 4 | |
564 | .IX Item "LINES_LEFT" | |
565 | .IP "\s-1TOP_NAME\s0" 4 | |
566 | .IX Item "TOP_NAME" | |
567 | .IP "\s-1TOP_GV\s0" 4 | |
568 | .IX Item "TOP_GV" | |
569 | .IP "\s-1FMT_NAME\s0" 4 | |
570 | .IX Item "FMT_NAME" | |
571 | .IP "\s-1FMT_GV\s0" 4 | |
572 | .IX Item "FMT_GV" | |
573 | .IP "\s-1BOTTOM_NAME\s0" 4 | |
574 | .IX Item "BOTTOM_NAME" | |
575 | .IP "\s-1BOTTOM_GV\s0" 4 | |
576 | .IX Item "BOTTOM_GV" | |
577 | .IP "\s-1SUBPROCESS\s0" 4 | |
578 | .IX Item "SUBPROCESS" | |
579 | .IP "IoTYPE" 4 | |
580 | .IX Item "IoTYPE" | |
581 | .IP "IoFLAGS" 4 | |
582 | .IX Item "IoFLAGS" | |
583 | .IP "IsSTD" 4 | |
584 | .IX Item "IsSTD" | |
585 | .PD | |
586 | Takes one arguments ( 'stdin' | 'stdout' | 'stderr' ) and returns true | |
587 | if the IoIFP of the object is equal to the handle whose name was | |
588 | passed as argument ( i.e. \f(CW$io\fR\->IsSTD('stderr') is true if | |
589 | IoIFP($io) == \fIPerlIO_stdin()\fR ). | |
590 | .Sh "B::AV Methods" | |
591 | .IX Subsection "B::AV Methods" | |
592 | .IP "\s-1FILL\s0" 4 | |
593 | .IX Item "FILL" | |
594 | .PD 0 | |
595 | .IP "\s-1MAX\s0" 4 | |
596 | .IX Item "MAX" | |
597 | .IP "\s-1OFF\s0" 4 | |
598 | .IX Item "OFF" | |
599 | .IP "\s-1ARRAY\s0" 4 | |
600 | .IX Item "ARRAY" | |
601 | .IP "ARRAYelt" 4 | |
602 | .IX Item "ARRAYelt" | |
603 | .PD | |
604 | Like \f(CW\*(C`ARRAY\*(C'\fR, but takes an index as an argument to get only one element, | |
605 | rather than a list of all of them. | |
606 | .IP "AvFLAGS" 4 | |
607 | .IX Item "AvFLAGS" | |
608 | .Sh "B::CV Methods" | |
609 | .IX Subsection "B::CV Methods" | |
610 | .PD 0 | |
611 | .IP "\s-1STASH\s0" 4 | |
612 | .IX Item "STASH" | |
613 | .IP "\s-1START\s0" 4 | |
614 | .IX Item "START" | |
615 | .IP "\s-1ROOT\s0" 4 | |
616 | .IX Item "ROOT" | |
617 | .IP "\s-1GV\s0" 4 | |
618 | .IX Item "GV" | |
619 | .IP "\s-1FILE\s0" 4 | |
620 | .IX Item "FILE" | |
621 | .IP "\s-1DEPTH\s0" 4 | |
622 | .IX Item "DEPTH" | |
623 | .IP "\s-1PADLIST\s0" 4 | |
624 | .IX Item "PADLIST" | |
625 | .IP "\s-1OUTSIDE\s0" 4 | |
626 | .IX Item "OUTSIDE" | |
627 | .IP "\s-1OUTSIDE_SEQ\s0" 4 | |
628 | .IX Item "OUTSIDE_SEQ" | |
629 | .IP "\s-1XSUB\s0" 4 | |
630 | .IX Item "XSUB" | |
631 | .IP "\s-1XSUBANY\s0" 4 | |
632 | .IX Item "XSUBANY" | |
633 | .PD | |
634 | For constant subroutines, returns the constant \s-1SV\s0 returned by the subroutine. | |
635 | .IP "CvFLAGS" 4 | |
636 | .IX Item "CvFLAGS" | |
637 | .PD 0 | |
638 | .IP "const_sv" 4 | |
639 | .IX Item "const_sv" | |
640 | .PD | |
641 | .Sh "B::HV Methods" | |
642 | .IX Subsection "B::HV Methods" | |
643 | .IP "\s-1FILL\s0" 4 | |
644 | .IX Item "FILL" | |
645 | .PD 0 | |
646 | .IP "\s-1MAX\s0" 4 | |
647 | .IX Item "MAX" | |
648 | .IP "\s-1KEYS\s0" 4 | |
649 | .IX Item "KEYS" | |
650 | .IP "\s-1RITER\s0" 4 | |
651 | .IX Item "RITER" | |
652 | .IP "\s-1NAME\s0" 4 | |
653 | .IX Item "NAME" | |
654 | .IP "\s-1PMROOT\s0" 4 | |
655 | .IX Item "PMROOT" | |
656 | .IP "\s-1ARRAY\s0" 4 | |
657 | .IX Item "ARRAY" | |
658 | .PD | |
659 | .Sh "OP-RELATED \s-1CLASSES\s0" | |
660 | .IX Subsection "OP-RELATED CLASSES" | |
661 | \&\f(CW\*(C`B::OP\*(C'\fR, \f(CW\*(C`B::UNOP\*(C'\fR, \f(CW\*(C`B::BINOP\*(C'\fR, \f(CW\*(C`B::LOGOP\*(C'\fR, \f(CW\*(C`B::LISTOP\*(C'\fR, \f(CW\*(C`B::PMOP\*(C'\fR, | |
662 | \&\f(CW\*(C`B::SVOP\*(C'\fR, \f(CW\*(C`B::PADOP\*(C'\fR, \f(CW\*(C`B::PVOP\*(C'\fR, \f(CW\*(C`B::LOOP\*(C'\fR, \f(CW\*(C`B::COP\*(C'\fR. | |
663 | .PP | |
664 | These classes correspond in the obvious way to the underlying C | |
665 | structures of similar names. The inheritance hierarchy mimics the | |
666 | underlying C \*(L"inheritance\*(R": | |
667 | .PP | |
668 | .Vb 14 | |
669 | \& B::OP | |
670 | \& | | |
671 | \& +---------------+--------+--------+ | |
672 | \& | | | | | |
673 | \& B::UNOP B::SVOP B::PADOP B::COP | |
674 | \& ,' `-. | |
675 | \& / `--. | |
676 | \& B::BINOP B::LOGOP | |
677 | \& | | |
678 | \& | | |
679 | \& B::LISTOP | |
680 | \& ,' `. | |
681 | \& / \e | |
682 | \& B::LOOP B::PMOP | |
683 | .Ve | |
684 | .PP | |
685 | Access methods correspond to the underlying C structre field names, | |
686 | with the leading \*(L"class indication\*(R" prefix (\f(CW"op_"\fR) removed. | |
687 | .Sh "B::OP Methods" | |
688 | .IX Subsection "B::OP Methods" | |
689 | These methods get the values of similarly named fields within the \s-1OP\s0 | |
690 | data structure. See top of \f(CW\*(C`op.h\*(C'\fR for more info. | |
691 | .IP "next" 4 | |
692 | .IX Item "next" | |
693 | .PD 0 | |
694 | .IP "sibling" 4 | |
695 | .IX Item "sibling" | |
696 | .IP "name" 4 | |
697 | .IX Item "name" | |
698 | .PD | |
699 | This returns the op name as a string (e.g. \*(L"add\*(R", \*(L"rv2av\*(R"). | |
700 | .IP "ppaddr" 4 | |
701 | .IX Item "ppaddr" | |
702 | This returns the function name as a string (e.g. \*(L"PL_ppaddr[\s-1OP_ADD\s0]\*(R", | |
703 | \&\*(L"PL_ppaddr[\s-1OP_RV2AV\s0]\*(R"). | |
704 | .IP "desc" 4 | |
705 | .IX Item "desc" | |
706 | This returns the op description from the global C PL_op_desc array | |
707 | (e.g. \*(L"addition\*(R" \*(L"array deref\*(R"). | |
708 | .IP "targ" 4 | |
709 | .IX Item "targ" | |
710 | .PD 0 | |
711 | .IP "type" 4 | |
712 | .IX Item "type" | |
713 | .IP "opt" 4 | |
714 | .IX Item "opt" | |
715 | .IP "static" 4 | |
716 | .IX Item "static" | |
717 | .IP "flags" 4 | |
718 | .IX Item "flags" | |
719 | .IP "private" 4 | |
720 | .IX Item "private" | |
721 | .IP "spare" 4 | |
722 | .IX Item "spare" | |
723 | .PD | |
724 | .Sh "B::UNOP \s-1METHOD\s0" | |
725 | .IX Subsection "B::UNOP METHOD" | |
726 | .IP "first" 4 | |
727 | .IX Item "first" | |
728 | .Sh "B::BINOP \s-1METHOD\s0" | |
729 | .IX Subsection "B::BINOP METHOD" | |
730 | .PD 0 | |
731 | .IP "last" 4 | |
732 | .IX Item "last" | |
733 | .PD | |
734 | .Sh "B::LOGOP \s-1METHOD\s0" | |
735 | .IX Subsection "B::LOGOP METHOD" | |
736 | .IP "other" 4 | |
737 | .IX Item "other" | |
738 | .Sh "B::LISTOP \s-1METHOD\s0" | |
739 | .IX Subsection "B::LISTOP METHOD" | |
740 | .PD 0 | |
741 | .IP "children" 4 | |
742 | .IX Item "children" | |
743 | .PD | |
744 | .Sh "B::PMOP Methods" | |
745 | .IX Subsection "B::PMOP Methods" | |
746 | .IP "pmreplroot" 4 | |
747 | .IX Item "pmreplroot" | |
748 | .PD 0 | |
749 | .IP "pmreplstart" 4 | |
750 | .IX Item "pmreplstart" | |
751 | .IP "pmnext" 4 | |
752 | .IX Item "pmnext" | |
753 | .IP "pmregexp" 4 | |
754 | .IX Item "pmregexp" | |
755 | .IP "pmflags" 4 | |
756 | .IX Item "pmflags" | |
757 | .IP "pmdynflags" 4 | |
758 | .IX Item "pmdynflags" | |
759 | .IP "pmpermflags" 4 | |
760 | .IX Item "pmpermflags" | |
761 | .IP "precomp" 4 | |
762 | .IX Item "precomp" | |
763 | .IP "pmoffset" 4 | |
764 | .IX Item "pmoffset" | |
765 | .PD | |
766 | Only when perl was compiled with ithreads. | |
767 | .Sh "B::SVOP \s-1METHOD\s0" | |
768 | .IX Subsection "B::SVOP METHOD" | |
769 | .IP "sv" 4 | |
770 | .IX Item "sv" | |
771 | .PD 0 | |
772 | .IP "gv" 4 | |
773 | .IX Item "gv" | |
774 | .PD | |
775 | .Sh "B::PADOP \s-1METHOD\s0" | |
776 | .IX Subsection "B::PADOP METHOD" | |
777 | .IP "padix" 4 | |
778 | .IX Item "padix" | |
779 | .Sh "B::PVOP \s-1METHOD\s0" | |
780 | .IX Subsection "B::PVOP METHOD" | |
781 | .PD 0 | |
782 | .IP "pv" 4 | |
783 | .IX Item "pv" | |
784 | .PD | |
785 | .Sh "B::LOOP Methods" | |
786 | .IX Subsection "B::LOOP Methods" | |
787 | .IP "redoop" 4 | |
788 | .IX Item "redoop" | |
789 | .PD 0 | |
790 | .IP "nextop" 4 | |
791 | .IX Item "nextop" | |
792 | .IP "lastop" 4 | |
793 | .IX Item "lastop" | |
794 | .PD | |
795 | .Sh "B::COP Methods" | |
796 | .IX Subsection "B::COP Methods" | |
797 | .IP "label" 4 | |
798 | .IX Item "label" | |
799 | .PD 0 | |
800 | .IP "stash" 4 | |
801 | .IX Item "stash" | |
802 | .IP "stashpv" 4 | |
803 | .IX Item "stashpv" | |
804 | .IP "file" 4 | |
805 | .IX Item "file" | |
806 | .IP "cop_seq" 4 | |
807 | .IX Item "cop_seq" | |
808 | .IP "arybase" 4 | |
809 | .IX Item "arybase" | |
810 | .IP "line" 4 | |
811 | .IX Item "line" | |
812 | .IP "warnings" 4 | |
813 | .IX Item "warnings" | |
814 | .IP "io" 4 | |
815 | .IX Item "io" | |
816 | .PD | |
817 | .SH "AUTHOR" | |
818 | .IX Header "AUTHOR" | |
819 | Malcolm Beattie, \f(CW\*(C`mbeattie@sable.ox.ac.uk\*(C'\fR |