Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / B.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
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 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide"
133.SH "NAME"
134B \- 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"
142The \f(CW\*(C`B\*(C'\fR module supplies classes which allow a Perl program to delve
143into 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
145require knowledge of this module: see the \fIO\fR module for the
146user-visible part. The \f(CW\*(C`B\*(C'\fR module is of use to those who want to
147write new compiler backends. This documentation assumes that the
148reader knows a fair amount about perl's internals including such
149things as SVs, OPs and the internal symbol table and syntax tree
150of a program.
151.SH "OVERVIEW OF CLASSES"
152.IX Header "OVERVIEW OF CLASSES"
153The C structures used by Perl's internals to hold \s-1SV\s0 and \s-1OP\s0
154information (\s-1PVIV\s0, \s-1AV\s0, \s-1HV\s0, ..., \s-1OP\s0, \s-1SVOP\s0, \s-1UNOP\s0, ...) are modelled on a
155class hierarchy and the \f(CW\*(C`B\*(C'\fR module gives access to them via a true
156object hierarchy. Structure fields which point to other objects
157(whether types of \s-1SV\s0 or types of \s-1OP\s0) are represented by the \f(CW\*(C`B\*(C'\fR
158module as Perl objects of the appropriate class. The bulk of the \f(CW\*(C`B\*(C'\fR
159module is the methods for accessing fields of these structures. Note
160that all access is read\-only: you cannot modify the internals by
161using this module.
162.Sh "SV-RELATED \s-1CLASSES\s0"
163.IX Subsection "SV-RELATED CLASSES"
164B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV,
165B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in
166the obvious way to the underlying C structures of similar names. The
167inheritance hierarchy mimics the underlying C \*(L"inheritance\*(R". Access
168methods correspond to the underlying C macros for field access,
169usually with the leading \*(L"class indication\*(R" prefix removed (Sv, Av,
170Hv, ...). The leading prefix is only left in cases where its removal
171would cause a clash in method name. For example, \f(CW\*(C`GvREFCNT\*(C'\fR stays
172as-is since its abbreviation would clash with the \*(L"superclass\*(R" method
173\&\f(CW\*(C`REFCNT\*(C'\fR (corresponding to the C function \f(CW\*(C`SvREFCNT\*(C'\fR).
174.Sh "B::SV \s-1METHODS\s0"
175.IX Subsection "B::SV METHODS"
176.IP "\s-1REFCNT\s0" 4
177.IX Item "REFCNT"
178.PD 0
179.IP "\s-1FLAGS\s0" 4
180.IX Item "FLAGS"
181.PD
182.Sh "B::IV \s-1METHODS\s0"
183.IX Subsection "B::IV METHODS"
184.IP "\s-1IV\s0" 4
185.IX Item "IV"
186Returns the value of the \s-1IV\s0, \fIinterpreted as
187a signed integer\fR. This will be misleading
188if \f(CW\*(C`FLAGS & SVf_IVisUV\*(C'\fR. Perhaps you want the
189\&\f(CW\*(C`int_value\*(C'\fR method instead?
190.IP "\s-1IVX\s0" 4
191.IX Item "IVX"
192.PD 0
193.IP "\s-1UVX\s0" 4
194.IX Item "UVX"
195.IP "int_value" 4
196.IX Item "int_value"
197.PD
198This method returns the value of the \s-1IV\s0 as an integer.
199It differs from \f(CW\*(C`IV\*(C'\fR in that it returns the correct
200value regardless of whether it's stored signed or
201unsigned.
202.IP "needs64bits" 4
203.IX Item "needs64bits"
204.PD 0
205.IP "packiv" 4
206.IX Item "packiv"
207.PD
208.Sh "B::NV \s-1METHODS\s0"
209.IX Subsection "B::NV METHODS"
210.IP "\s-1NV\s0" 4
211.IX Item "NV"
212.PD 0
213.IP "\s-1NVX\s0" 4
214.IX Item "NVX"
215.PD
216.Sh "B::RV \s-1METHODS\s0"
217.IX Subsection "B::RV METHODS"
218.IP "\s-1RV\s0" 4
219.IX Item "RV"
220.Sh "B::PV \s-1METHODS\s0"
221.IX Subsection "B::PV METHODS"
222.PD 0
223.IP "\s-1PV\s0" 4
224.IX Item "PV"
225.PD
226This method is the one you usually want. It constructs a
227string using the length and offset information in the struct:
228for ordinary scalars it will return the string that you'd see
229from Perl, even if it contains null characters.
230.IP "\s-1RV\s0" 4
231.IX Item "RV"
232Same as B::RV::RV, except that it will \fIdie()\fR if the \s-1PV\s0 isn't
233a reference.
234.IP "\s-1PVX\s0" 4
235.IX Item "PVX"
236This method is less often useful. It assumes that the string
237stored in the struct is null\-terminated, and disregards the
238length information.
239.Sp
240It is the appropriate method to use if you need to get the name
241of a lexical variable from a padname array. Lexical variable names
242are always stored with a null terminator, and the length field
243(SvCUR) is overloaded for other purposes and can't be relied on here.
244.Sh "B::PVMG \s-1METHODS\s0"
245.IX Subsection "B::PVMG METHODS"
246.IP "\s-1MAGIC\s0" 4
247.IX Item "MAGIC"
248.PD 0
249.IP "SvSTASH" 4
250.IX Item "SvSTASH"
251.PD
252.Sh "B::MAGIC \s-1METHODS\s0"
253.IX Subsection "B::MAGIC METHODS"
254.IP "\s-1MOREMAGIC\s0" 4
255.IX Item "MOREMAGIC"
256.PD 0
257.IP "precomp" 4
258.IX Item "precomp"
259.PD
260Only valid on r\-magic, returns the string that generated the regexp.
261.IP "\s-1PRIVATE\s0" 4
262.IX Item "PRIVATE"
263.PD 0
264.IP "\s-1TYPE\s0" 4
265.IX Item "TYPE"
266.IP "\s-1FLAGS\s0" 4
267.IX Item "FLAGS"
268.IP "\s-1OBJ\s0" 4
269.IX Item "OBJ"
270.PD
271Will \fIdie()\fR if called on r\-magic.
272.IP "\s-1PTR\s0" 4
273.IX Item "PTR"
274.PD 0
275.IP "\s-1REGEX\s0" 4
276.IX Item "REGEX"
277.PD
278Only valid on r\-magic, returns the integer value of the \s-1REGEX\s0 stored
279in the \s-1MAGIC\s0.
280.Sh "B::PVLV \s-1METHODS\s0"
281.IX Subsection "B::PVLV METHODS"
282.IP "\s-1TARGOFF\s0" 4
283.IX Item "TARGOFF"
284.PD 0
285.IP "\s-1TARGLEN\s0" 4
286.IX Item "TARGLEN"
287.IP "\s-1TYPE\s0" 4
288.IX Item "TYPE"
289.IP "\s-1TARG\s0" 4
290.IX Item "TARG"
291.PD
292.Sh "B::BM \s-1METHODS\s0"
293.IX Subsection "B::BM METHODS"
294.IP "\s-1USEFUL\s0" 4
295.IX Item "USEFUL"
296.PD 0
297.IP "\s-1PREVIOUS\s0" 4
298.IX Item "PREVIOUS"
299.IP "\s-1RARE\s0" 4
300.IX Item "RARE"
301.IP "\s-1TABLE\s0" 4
302.IX Item "TABLE"
303.PD
304.Sh "B::GV \s-1METHODS\s0"
305.IX Subsection "B::GV METHODS"
306.IP "is_empty" 4
307.IX Item "is_empty"
308This method returns \s-1TRUE\s0 if the \s-1GP\s0 field of the \s-1GV\s0 is \s-1NULL\s0.
309.IP "\s-1NAME\s0" 4
310.IX Item "NAME"
311.PD 0
312.IP "\s-1SAFENAME\s0" 4
313.IX Item "SAFENAME"
314.PD
315This method returns the name of the glob, but if the first
316character of the name is a control character, then it converts
317it to ^X first, so that *^G would return \*(L"^G\*(R" rather than \*(L"\ecG\*(R".
318.Sp
319It's useful if you want to print out the name of a variable.
320If you restrict yourself to globs which exist at compile-time
321then the result ought to be unambiguous, because code like
322\&\f(CW\*(C`${"^G"} = 1\*(C'\fR is compiled as two ops \- a constant string and
323a dereference (rv2gv) \- so that the glob is created at runtime.
324.Sp
325If you're working with globs at runtime, and need to disambiguate
326*^G from *{\*(L"^G\*(R"}, then you should use the raw \s-1NAME\s0 method.
327.IP "\s-1STASH\s0" 4
328.IX Item "STASH"
329.PD 0
330.IP "\s-1SV\s0" 4
331.IX Item "SV"
332.IP "\s-1IO\s0" 4
333.IX Item "IO"
334.IP "\s-1FORM\s0" 4
335.IX Item "FORM"
336.IP "\s-1AV\s0" 4
337.IX Item "AV"
338.IP "\s-1HV\s0" 4
339.IX Item "HV"
340.IP "\s-1EGV\s0" 4
341.IX Item "EGV"
342.IP "\s-1CV\s0" 4
343.IX Item "CV"
344.IP "\s-1CVGEN\s0" 4
345.IX Item "CVGEN"
346.IP "\s-1LINE\s0" 4
347.IX Item "LINE"
348.IP "\s-1FILE\s0" 4
349.IX Item "FILE"
350.IP "\s-1FILEGV\s0" 4
351.IX Item "FILEGV"
352.IP "GvREFCNT" 4
353.IX Item "GvREFCNT"
354.IP "\s-1FLAGS\s0" 4
355.IX Item "FLAGS"
356.PD
357.Sh "B::IO \s-1METHODS\s0"
358.IX Subsection "B::IO METHODS"
359.IP "\s-1LINES\s0" 4
360.IX Item "LINES"
361.PD 0
362.IP "\s-1PAGE\s0" 4
363.IX Item "PAGE"
364.IP "\s-1PAGE_LEN\s0" 4
365.IX Item "PAGE_LEN"
366.IP "\s-1LINES_LEFT\s0" 4
367.IX Item "LINES_LEFT"
368.IP "\s-1TOP_NAME\s0" 4
369.IX Item "TOP_NAME"
370.IP "\s-1TOP_GV\s0" 4
371.IX Item "TOP_GV"
372.IP "\s-1FMT_NAME\s0" 4
373.IX Item "FMT_NAME"
374.IP "\s-1FMT_GV\s0" 4
375.IX Item "FMT_GV"
376.IP "\s-1BOTTOM_NAME\s0" 4
377.IX Item "BOTTOM_NAME"
378.IP "\s-1BOTTOM_GV\s0" 4
379.IX Item "BOTTOM_GV"
380.IP "\s-1SUBPROCESS\s0" 4
381.IX Item "SUBPROCESS"
382.IP "IoTYPE" 4
383.IX Item "IoTYPE"
384.IP "IoFLAGS" 4
385.IX Item "IoFLAGS"
386.IP "IsSTD" 4
387.IX Item "IsSTD"
388.PD
389Takes one arguments ( 'stdin' | 'stdout' | 'stderr' ) and returns true
390if the IoIFP of the object is equal to the handle whose name was
391passed as argument ( i.e. \f(CW$io\fR\->IsSTD('stderr') is true if
392IoIFP($io) == \fIPerlIO_stdin()\fR ).
393.Sh "B::AV \s-1METHODS\s0"
394.IX Subsection "B::AV METHODS"
395.IP "\s-1FILL\s0" 4
396.IX Item "FILL"
397.PD 0
398.IP "\s-1MAX\s0" 4
399.IX Item "MAX"
400.IP "\s-1OFF\s0" 4
401.IX Item "OFF"
402.IP "\s-1ARRAY\s0" 4
403.IX Item "ARRAY"
404.IP "AvFLAGS" 4
405.IX Item "AvFLAGS"
406.PD
407.Sh "B::CV \s-1METHODS\s0"
408.IX Subsection "B::CV METHODS"
409.IP "\s-1STASH\s0" 4
410.IX Item "STASH"
411.PD 0
412.IP "\s-1START\s0" 4
413.IX Item "START"
414.IP "\s-1ROOT\s0" 4
415.IX Item "ROOT"
416.IP "\s-1GV\s0" 4
417.IX Item "GV"
418.IP "\s-1FILE\s0" 4
419.IX Item "FILE"
420.IP "\s-1DEPTH\s0" 4
421.IX Item "DEPTH"
422.IP "\s-1PADLIST\s0" 4
423.IX Item "PADLIST"
424.IP "\s-1OUTSIDE\s0" 4
425.IX Item "OUTSIDE"
426.IP "\s-1XSUB\s0" 4
427.IX Item "XSUB"
428.IP "\s-1XSUBANY\s0" 4
429.IX Item "XSUBANY"
430.PD
431For constant subroutines, returns the constant \s-1SV\s0 returned by the subroutine.
432.IP "CvFLAGS" 4
433.IX Item "CvFLAGS"
434.PD 0
435.IP "const_sv" 4
436.IX Item "const_sv"
437.PD
438.Sh "B::HV \s-1METHODS\s0"
439.IX Subsection "B::HV METHODS"
440.IP "\s-1FILL\s0" 4
441.IX Item "FILL"
442.PD 0
443.IP "\s-1MAX\s0" 4
444.IX Item "MAX"
445.IP "\s-1KEYS\s0" 4
446.IX Item "KEYS"
447.IP "\s-1RITER\s0" 4
448.IX Item "RITER"
449.IP "\s-1NAME\s0" 4
450.IX Item "NAME"
451.IP "\s-1PMROOT\s0" 4
452.IX Item "PMROOT"
453.IP "\s-1ARRAY\s0" 4
454.IX Item "ARRAY"
455.PD
456.Sh "OP-RELATED \s-1CLASSES\s0"
457.IX Subsection "OP-RELATED CLASSES"
458B::OP, B::UNOP, B::BINOP, B::LOGOP, B::LISTOP, B::PMOP,
459B::SVOP, B::PADOP, B::PVOP, B::CVOP, B::LOOP, B::COP.
460These classes correspond in
461the obvious way to the underlying C structures of similar names. The
462inheritance hierarchy mimics the underlying C \*(L"inheritance\*(R". Access
463methods correspond to the underlying C structre field names, with the
464leading \*(L"class indication\*(R" prefix removed (op_).
465.Sh "B::OP \s-1METHODS\s0"
466.IX Subsection "B::OP METHODS"
467.IP "next" 4
468.IX Item "next"
469.PD 0
470.IP "sibling" 4
471.IX Item "sibling"
472.IP "name" 4
473.IX Item "name"
474.PD
475This returns the op name as a string (e.g. \*(L"add\*(R", \*(L"rv2av\*(R").
476.IP "ppaddr" 4
477.IX Item "ppaddr"
478This returns the function name as a string (e.g. \*(L"PL_ppaddr[\s-1OP_ADD\s0]\*(R",
479\&\*(L"PL_ppaddr[\s-1OP_RV2AV\s0]\*(R").
480.IP "desc" 4
481.IX Item "desc"
482This returns the op description from the global C PL_op_desc array
483(e.g. \*(L"addition\*(R" \*(L"array deref\*(R").
484.IP "targ" 4
485.IX Item "targ"
486.PD 0
487.IP "type" 4
488.IX Item "type"
489.IP "seq" 4
490.IX Item "seq"
491.IP "flags" 4
492.IX Item "flags"
493.IP "private" 4
494.IX Item "private"
495.PD
496.Sh "B::UNOP \s-1METHOD\s0"
497.IX Subsection "B::UNOP METHOD"
498.IP "first" 4
499.IX Item "first"
500.Sh "B::BINOP \s-1METHOD\s0"
501.IX Subsection "B::BINOP METHOD"
502.PD 0
503.IP "last" 4
504.IX Item "last"
505.PD
506.Sh "B::LOGOP \s-1METHOD\s0"
507.IX Subsection "B::LOGOP METHOD"
508.IP "other" 4
509.IX Item "other"
510.Sh "B::LISTOP \s-1METHOD\s0"
511.IX Subsection "B::LISTOP METHOD"
512.PD 0
513.IP "children" 4
514.IX Item "children"
515.PD
516.Sh "B::PMOP \s-1METHODS\s0"
517.IX Subsection "B::PMOP METHODS"
518.IP "pmreplroot" 4
519.IX Item "pmreplroot"
520.PD 0
521.IP "pmreplstart" 4
522.IX Item "pmreplstart"
523.IP "pmnext" 4
524.IX Item "pmnext"
525.IP "pmregexp" 4
526.IX Item "pmregexp"
527.IP "pmflags" 4
528.IX Item "pmflags"
529.IP "pmdynflags" 4
530.IX Item "pmdynflags"
531.IP "pmpermflags" 4
532.IX Item "pmpermflags"
533.IP "precomp" 4
534.IX Item "precomp"
535.IP "pmoffet" 4
536.IX Item "pmoffet"
537.PD
538Only when perl was compiled with ithreads.
539.Sh "B::SVOP \s-1METHOD\s0"
540.IX Subsection "B::SVOP METHOD"
541.IP "sv" 4
542.IX Item "sv"
543.PD 0
544.IP "gv" 4
545.IX Item "gv"
546.PD
547.Sh "B::PADOP \s-1METHOD\s0"
548.IX Subsection "B::PADOP METHOD"
549.IP "padix" 4
550.IX Item "padix"
551.Sh "B::PVOP \s-1METHOD\s0"
552.IX Subsection "B::PVOP METHOD"
553.PD 0
554.IP "pv" 4
555.IX Item "pv"
556.PD
557.Sh "B::LOOP \s-1METHODS\s0"
558.IX Subsection "B::LOOP METHODS"
559.IP "redoop" 4
560.IX Item "redoop"
561.PD 0
562.IP "nextop" 4
563.IX Item "nextop"
564.IP "lastop" 4
565.IX Item "lastop"
566.PD
567.Sh "B::COP \s-1METHODS\s0"
568.IX Subsection "B::COP METHODS"
569.IP "label" 4
570.IX Item "label"
571.PD 0
572.IP "stash" 4
573.IX Item "stash"
574.IP "file" 4
575.IX Item "file"
576.IP "cop_seq" 4
577.IX Item "cop_seq"
578.IP "arybase" 4
579.IX Item "arybase"
580.IP "line" 4
581.IX Item "line"
582.PD
583.ie n .SH "FUNCTIONS EXPORTED BY ""B"""
584.el .SH "FUNCTIONS EXPORTED BY \f(CWB\fP"
585.IX Header "FUNCTIONS EXPORTED BY B"
586The \f(CW\*(C`B\*(C'\fR module exports a variety of functions: some are simple
587utility functions, others provide a Perl program with a way to
588get an initial \*(L"handle\*(R" on an internal object.
589.IP "main_cv" 4
590.IX Item "main_cv"
591Return the (faked) \s-1CV\s0 corresponding to the main part of the Perl
592program.
593.IP "init_av" 4
594.IX Item "init_av"
595Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1INIT\s0 blocks.
596.IP "begin_av" 4
597.IX Item "begin_av"
598Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1BEGIN\s0 blocks.
599.IP "end_av" 4
600.IX Item "end_av"
601Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1END\s0 blocks.
602.IP "main_root" 4
603.IX Item "main_root"
604Returns the root op (i.e. an object in the appropriate B::OP\-derived
605class) of the main part of the Perl program.
606.IP "main_start" 4
607.IX Item "main_start"
608Returns the starting op of the main part of the Perl program.
609.IP "comppadlist" 4
610.IX Item "comppadlist"
611Returns the \s-1AV\s0 object (i.e. in class B::AV) of the global comppadlist.
612.IP "regex_padav" 4
613.IX Item "regex_padav"
614Only when perl was compiled with ithreads.
615.IP "sv_undef" 4
616.IX Item "sv_undef"
617Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_undef\*(C'\fR.
618.IP "sv_yes" 4
619.IX Item "sv_yes"
620Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_yes\*(C'\fR.
621.IP "sv_no" 4
622.IX Item "sv_no"
623Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_no\*(C'\fR.
624.IP "amagic_generation" 4
625.IX Item "amagic_generation"
626Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`amagic_generation\*(C'\fR.
627.IP "walkoptree(\s-1OP\s0, \s-1METHOD\s0)" 4
628.IX Item "walkoptree(OP, METHOD)"
629Does a tree-walk of the syntax tree based at \s-1OP\s0 and calls \s-1METHOD\s0 on
630each op it visits. Each node is visited before its children. If
631\&\f(CW\*(C`walkoptree_debug\*(C'\fR (q.v.) has been called to turn debugging on then
632the method \f(CW\*(C`walkoptree_debug\*(C'\fR is called on each op before \s-1METHOD\s0 is
633called.
634.IP "walkoptree_debug(\s-1DEBUG\s0)" 4
635.IX Item "walkoptree_debug(DEBUG)"
636Returns the current debugging flag for \f(CW\*(C`walkoptree\*(C'\fR. If the optional
637\&\s-1DEBUG\s0 argument is non\-zero, it sets the debugging flag to that. See
638the description of \f(CW\*(C`walkoptree\*(C'\fR above for what the debugging flag
639does.
640.IP "walksymtable(\s-1SYMREF\s0, \s-1METHOD\s0, \s-1RECURSE\s0, \s-1PREFIX\s0)" 4
641.IX Item "walksymtable(SYMREF, METHOD, RECURSE, PREFIX)"
642Walk the symbol table starting at \s-1SYMREF\s0 and call \s-1METHOD\s0 on each
643symbol (a B::GV object) visited. When the walk reaches package
644symbols (such as \*(L"Foo::\*(R") it invokes \s-1RECURSE\s0, passing in the symbol
645name, and only recurses into the package if that sub returns true.
646.Sp
647\&\s-1PREFIX\s0 is the name of the \s-1SYMREF\s0 you're walking.
648.Sp
649For example...
650.Sp
651.Vb 4
652\& # Walk CGI's symbol table calling print_subs on each symbol.
653\& # Only recurse into CGI::Util::
654\& walksymtable(\e%CGI::, 'print_subs', sub { $_[0] eq 'CGI::Util::' },
655\& 'CGI::');
656.Ve
657.Sp
658\&\fIprint_subs()\fR is a B::GV method you have declared.
659.IP "svref_2object(\s-1SV\s0)" 4
660.IX Item "svref_2object(SV)"
661Takes any Perl variable and turns it into an object in the
662appropriate B::OP\-derived or B::SV\-derived class. Apart from functions
663such as \f(CW\*(C`main_root\*(C'\fR, this is the primary way to get an initial
664\&\*(L"handle\*(R" on an internal perl data structure which can then be followed
665with the other access methods.
666.IP "ppname(\s-1OPNUM\s0)" 4
667.IX Item "ppname(OPNUM)"
668Return the \s-1PP\s0 function name (e.g. \*(L"pp_add\*(R") of op number \s-1OPNUM\s0.
669.IP "hash(\s-1STR\s0)" 4
670.IX Item "hash(STR)"
671Returns a string in the form \*(L"0x...\*(R" representing the value of the
672internal hash function used by perl on string \s-1STR\s0.
673.IP "cast_I32(I)" 4
674.IX Item "cast_I32(I)"
675Casts I to the internal I32 type used by that perl.
676.IP "minus_c" 4
677.IX Item "minus_c"
678Does the equivalent of the \f(CW\*(C`\-c\*(C'\fR command-line option. Obviously, this
679is only useful in a \s-1BEGIN\s0 block or else the flag is set too late.
680.IP "cstring(\s-1STR\s0)" 4
681.IX Item "cstring(STR)"
682Returns a double-quote-surrounded escaped version of \s-1STR\s0 which can
683be used as a string in C source code.
684.IP "perlstring(\s-1STR\s0)" 4
685.IX Item "perlstring(STR)"
686Returns a double-quote-surrounded escaped version of \s-1STR\s0 which can
687be used as a string in Perl source code.
688.IP "class(\s-1OBJ\s0)" 4
689.IX Item "class(OBJ)"
690Returns the class of an object without the part of the classname
691preceding the first \*(L"::\*(R". This is used to turn \*(L"B::UNOP\*(R" into
692\&\*(L"\s-1UNOP\s0\*(R" for example.
693.IP "threadsv_names" 4
694.IX Item "threadsv_names"
695In a perl compiled for threads, this returns a list of the special
696per-thread threadsv variables.
697.SH "AUTHOR"
698.IX Header "AUTHOR"
699Malcolm Beattie, \f(CW\*(C`mbeattie@sable.ox.ac.uk\*(C'\fR