Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/man/2perl/B

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "B 3"
.TH B 3 "2002-11-24" "perl v5.8.0" "Perl Programmers Reference Guide"
.SH "NAME"
B \- The Perl Compiler
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\&        use B;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \f(CW\*(C`B\*(C'\fR module supplies classes which allow a Perl program to delve
into its own innards. It is the module used to implement the
\&\*(L"backends\*(R" of the Perl compiler. Usage of the compiler does not
require knowledge of this module: see the \fIO\fR module for the
user-visible part. The \f(CW\*(C`B\*(C'\fR module is of use to those who want to
write new compiler backends. This documentation assumes that the
reader knows a fair amount about perl's internals including such
things as SVs, OPs and the internal symbol table and syntax tree
of a program.
.SH "OVERVIEW OF CLASSES"
.IX Header "OVERVIEW OF CLASSES"
The C structures used by Perl's internals to hold \s-1SV\s0 and \s-1OP\s0
information (\s-1PVIV\s0, \s-1AV\s0, \s-1HV\s0, ..., \s-1OP\s0, \s-1SVOP\s0, \s-1UNOP\s0, ...) are modelled on a
class hierarchy and the \f(CW\*(C`B\*(C'\fR module gives access to them via a true
object hierarchy. Structure fields which point to other objects
(whether types of \s-1SV\s0 or types of \s-1OP\s0) are represented by the \f(CW\*(C`B\*(C'\fR
module as Perl objects of the appropriate class. The bulk of the \f(CW\*(C`B\*(C'\fR
module is the methods for accessing fields of these structures. Note
that all access is read\-only: you cannot modify the internals by
using this module.
.Sh "SV-RELATED \s-1CLASSES\s0"
.IX Subsection "SV-RELATED CLASSES"
B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV,
B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in
the obvious way to the underlying C structures of similar names. The
inheritance hierarchy mimics the underlying C \*(L"inheritance\*(R". Access
methods correspond to the underlying C macros for field access,
usually with the leading \*(L"class indication\*(R" prefix removed (Sv, Av,
Hv, ...). The leading prefix is only left in cases where its removal
would cause a clash in method name. For example, \f(CW\*(C`GvREFCNT\*(C'\fR stays
as-is since its abbreviation would clash with the \*(L"superclass\*(R" method
\&\f(CW\*(C`REFCNT\*(C'\fR (corresponding to the C function \f(CW\*(C`SvREFCNT\*(C'\fR).
.Sh "B::SV \s-1METHODS\s0"
.IX Subsection "B::SV METHODS"
.IP "\s-1REFCNT\s0" 4
.IX Item "REFCNT"
.PD 0
.IP "\s-1FLAGS\s0" 4
.IX Item "FLAGS"
.PD
.Sh "B::IV \s-1METHODS\s0"
.IX Subsection "B::IV METHODS"
.IP "\s-1IV\s0" 4
.IX Item "IV"
Returns the value of the \s-1IV\s0, \fIinterpreted as
a signed integer\fR. This will be misleading
if \f(CW\*(C`FLAGS & SVf_IVisUV\*(C'\fR. Perhaps you want the
\&\f(CW\*(C`int_value\*(C'\fR method instead?
.IP "\s-1IVX\s0" 4
.IX Item "IVX"
.PD 0
.IP "\s-1UVX\s0" 4
.IX Item "UVX"
.IP "int_value" 4
.IX Item "int_value"
.PD
This method returns the value of the \s-1IV\s0 as an integer.
It differs from \f(CW\*(C`IV\*(C'\fR in that it returns the correct
value regardless of whether it's stored signed or
unsigned.
.IP "needs64bits" 4
.IX Item "needs64bits"
.PD 0
.IP "packiv" 4
.IX Item "packiv"
.PD
.Sh "B::NV \s-1METHODS\s0"
.IX Subsection "B::NV METHODS"
.IP "\s-1NV\s0" 4
.IX Item "NV"
.PD 0
.IP "\s-1NVX\s0" 4
.IX Item "NVX"
.PD
.Sh "B::RV \s-1METHODS\s0"
.IX Subsection "B::RV METHODS"
.IP "\s-1RV\s0" 4
.IX Item "RV"
.Sh "B::PV \s-1METHODS\s0"
.IX Subsection "B::PV METHODS"
.PD 0
.IP "\s-1PV\s0" 4
.IX Item "PV"
.PD
This method is the one you usually want. It constructs a
string using the length and offset information in the struct:
for ordinary scalars it will return the string that you'd see
from Perl, even if it contains null characters.
.IP "\s-1RV\s0" 4
.IX Item "RV"
Same as B::RV::RV, except that it will \fIdie()\fR if the \s-1PV\s0 isn't
a reference.
.IP "\s-1PVX\s0" 4
.IX Item "PVX"
This method is less often useful. It assumes that the string
stored in the struct is null\-terminated, and disregards the
length information.
.Sp
It is the appropriate method to use if you need to get the name
of a lexical variable from a padname array. Lexical variable names
are always stored with a null terminator, and the length field
(SvCUR) is overloaded for other purposes and can't be relied on here.
.Sh "B::PVMG \s-1METHODS\s0"
.IX Subsection "B::PVMG METHODS"
.IP "\s-1MAGIC\s0" 4
.IX Item "MAGIC"
.PD 0
.IP "SvSTASH" 4
.IX Item "SvSTASH"
.PD
.Sh "B::MAGIC \s-1METHODS\s0"
.IX Subsection "B::MAGIC METHODS"
.IP "\s-1MOREMAGIC\s0" 4
.IX Item "MOREMAGIC"
.PD 0
.IP "precomp" 4
.IX Item "precomp"
.PD
Only valid on r\-magic, returns the string that generated the regexp.
.IP "\s-1PRIVATE\s0" 4
.IX Item "PRIVATE"
.PD 0
.IP "\s-1TYPE\s0" 4
.IX Item "TYPE"
.IP "\s-1FLAGS\s0" 4
.IX Item "FLAGS"
.IP "\s-1OBJ\s0" 4
.IX Item "OBJ"
.PD
Will \fIdie()\fR if called on r\-magic.
.IP "\s-1PTR\s0" 4
.IX Item "PTR"
.PD 0
.IP "\s-1REGEX\s0" 4
.IX Item "REGEX"
.PD
Only valid on r\-magic, returns the integer value of the \s-1REGEX\s0 stored
in the \s-1MAGIC\s0.
.Sh "B::PVLV \s-1METHODS\s0"
.IX Subsection "B::PVLV METHODS"
.IP "\s-1TARGOFF\s0" 4
.IX Item "TARGOFF"
.PD 0
.IP "\s-1TARGLEN\s0" 4
.IX Item "TARGLEN"
.IP "\s-1TYPE\s0" 4
.IX Item "TYPE"
.IP "\s-1TARG\s0" 4
.IX Item "TARG"
.PD
.Sh "B::BM \s-1METHODS\s0"
.IX Subsection "B::BM METHODS"
.IP "\s-1USEFUL\s0" 4
.IX Item "USEFUL"
.PD 0
.IP "\s-1PREVIOUS\s0" 4
.IX Item "PREVIOUS"
.IP "\s-1RARE\s0" 4
.IX Item "RARE"
.IP "\s-1TABLE\s0" 4
.IX Item "TABLE"
.PD
.Sh "B::GV \s-1METHODS\s0"
.IX Subsection "B::GV METHODS"
.IP "is_empty" 4
.IX Item "is_empty"
This method returns \s-1TRUE\s0 if the \s-1GP\s0 field of the \s-1GV\s0 is \s-1NULL\s0.
.IP "\s-1NAME\s0" 4
.IX Item "NAME"
.PD 0
.IP "\s-1SAFENAME\s0" 4
.IX Item "SAFENAME"
.PD
This method returns the name of the glob, but if the first
character of the name is a control character, then it converts
it to ^X first, so that *^G would return \*(L"^G\*(R" rather than \*(L"\ecG\*(R".
.Sp
It's useful if you want to print out the name of a variable.
If you restrict yourself to globs which exist at compile-time
then the result ought to be unambiguous, because code like
\&\f(CW\*(C`${"^G"} = 1\*(C'\fR is compiled as two ops \- a constant string and
a dereference (rv2gv) \- so that the glob is created at runtime.
.Sp
If you're working with globs at runtime, and need to disambiguate
*^G from *{\*(L"^G\*(R"}, then you should use the raw \s-1NAME\s0 method.
.IP "\s-1STASH\s0" 4
.IX Item "STASH"
.PD 0
.IP "\s-1SV\s0" 4
.IX Item "SV"
.IP "\s-1IO\s0" 4
.IX Item "IO"
.IP "\s-1FORM\s0" 4
.IX Item "FORM"
.IP "\s-1AV\s0" 4
.IX Item "AV"
.IP "\s-1HV\s0" 4
.IX Item "HV"
.IP "\s-1EGV\s0" 4
.IX Item "EGV"
.IP "\s-1CV\s0" 4
.IX Item "CV"
.IP "\s-1CVGEN\s0" 4
.IX Item "CVGEN"
.IP "\s-1LINE\s0" 4
.IX Item "LINE"
.IP "\s-1FILE\s0" 4
.IX Item "FILE"
.IP "\s-1FILEGV\s0" 4
.IX Item "FILEGV"
.IP "GvREFCNT" 4
.IX Item "GvREFCNT"
.IP "\s-1FLAGS\s0" 4
.IX Item "FLAGS"
.PD
.Sh "B::IO \s-1METHODS\s0"
.IX Subsection "B::IO METHODS"
.IP "\s-1LINES\s0" 4
.IX Item "LINES"
.PD 0
.IP "\s-1PAGE\s0" 4
.IX Item "PAGE"
.IP "\s-1PAGE_LEN\s0" 4
.IX Item "PAGE_LEN"
.IP "\s-1LINES_LEFT\s0" 4
.IX Item "LINES_LEFT"
.IP "\s-1TOP_NAME\s0" 4
.IX Item "TOP_NAME"
.IP "\s-1TOP_GV\s0" 4
.IX Item "TOP_GV"
.IP "\s-1FMT_NAME\s0" 4
.IX Item "FMT_NAME"
.IP "\s-1FMT_GV\s0" 4
.IX Item "FMT_GV"
.IP "\s-1BOTTOM_NAME\s0" 4
.IX Item "BOTTOM_NAME"
.IP "\s-1BOTTOM_GV\s0" 4
.IX Item "BOTTOM_GV"
.IP "\s-1SUBPROCESS\s0" 4
.IX Item "SUBPROCESS"
.IP "IoTYPE" 4
.IX Item "IoTYPE"
.IP "IoFLAGS" 4
.IX Item "IoFLAGS"
.IP "IsSTD" 4
.IX Item "IsSTD"
.PD
Takes one arguments ( 'stdin' | 'stdout' | 'stderr' ) and returns true
if the IoIFP of the object is equal to the handle whose name was
passed as argument ( i.e. \f(CW$io\fR\->IsSTD('stderr') is true if
IoIFP($io) == \fIPerlIO_stdin()\fR ).
.Sh "B::AV \s-1METHODS\s0"
.IX Subsection "B::AV METHODS"
.IP "\s-1FILL\s0" 4
.IX Item "FILL"
.PD 0
.IP "\s-1MAX\s0" 4
.IX Item "MAX"
.IP "\s-1OFF\s0" 4
.IX Item "OFF"
.IP "\s-1ARRAY\s0" 4
.IX Item "ARRAY"
.IP "AvFLAGS" 4
.IX Item "AvFLAGS"
.PD
.Sh "B::CV \s-1METHODS\s0"
.IX Subsection "B::CV METHODS"
.IP "\s-1STASH\s0" 4
.IX Item "STASH"
.PD 0
.IP "\s-1START\s0" 4
.IX Item "START"
.IP "\s-1ROOT\s0" 4
.IX Item "ROOT"
.IP "\s-1GV\s0" 4
.IX Item "GV"
.IP "\s-1FILE\s0" 4
.IX Item "FILE"
.IP "\s-1DEPTH\s0" 4
.IX Item "DEPTH"
.IP "\s-1PADLIST\s0" 4
.IX Item "PADLIST"
.IP "\s-1OUTSIDE\s0" 4
.IX Item "OUTSIDE"
.IP "\s-1XSUB\s0" 4
.IX Item "XSUB"
.IP "\s-1XSUBANY\s0" 4
.IX Item "XSUBANY"
.PD
For constant subroutines, returns the constant \s-1SV\s0 returned by the subroutine.
.IP "CvFLAGS" 4
.IX Item "CvFLAGS"
.PD 0
.IP "const_sv" 4
.IX Item "const_sv"
.PD
.Sh "B::HV \s-1METHODS\s0"
.IX Subsection "B::HV METHODS"
.IP "\s-1FILL\s0" 4
.IX Item "FILL"
.PD 0
.IP "\s-1MAX\s0" 4
.IX Item "MAX"
.IP "\s-1KEYS\s0" 4
.IX Item "KEYS"
.IP "\s-1RITER\s0" 4
.IX Item "RITER"
.IP "\s-1NAME\s0" 4
.IX Item "NAME"
.IP "\s-1PMROOT\s0" 4
.IX Item "PMROOT"
.IP "\s-1ARRAY\s0" 4
.IX Item "ARRAY"
.PD
.Sh "OP-RELATED \s-1CLASSES\s0"
.IX Subsection "OP-RELATED CLASSES"
B::OP, B::UNOP, B::BINOP, B::LOGOP, B::LISTOP, B::PMOP,
B::SVOP, B::PADOP, B::PVOP, B::CVOP, B::LOOP, B::COP.
These classes correspond in
the obvious way to the underlying C structures of similar names. The
inheritance hierarchy mimics the underlying C \*(L"inheritance\*(R". Access
methods correspond to the underlying C structre field names, with the
leading \*(L"class indication\*(R" prefix removed (op_).
.Sh "B::OP \s-1METHODS\s0"
.IX Subsection "B::OP METHODS"
.IP "next" 4
.IX Item "next"
.PD 0
.IP "sibling" 4
.IX Item "sibling"
.IP "name" 4
.IX Item "name"
.PD
This returns the op name as a string (e.g. \*(L"add\*(R", \*(L"rv2av\*(R").
.IP "ppaddr" 4
.IX Item "ppaddr"
This returns the function name as a string (e.g. \*(L"PL_ppaddr[\s-1OP_ADD\s0]\*(R",
\&\*(L"PL_ppaddr[\s-1OP_RV2AV\s0]\*(R").
.IP "desc" 4
.IX Item "desc"
This returns the op description from the global C PL_op_desc array
(e.g. \*(L"addition\*(R" \*(L"array deref\*(R").
.IP "targ" 4
.IX Item "targ"
.PD 0
.IP "type" 4
.IX Item "type"
.IP "seq" 4
.IX Item "seq"
.IP "flags" 4
.IX Item "flags"
.IP "private" 4
.IX Item "private"
.PD
.Sh "B::UNOP \s-1METHOD\s0"
.IX Subsection "B::UNOP METHOD"
.IP "first" 4
.IX Item "first"
.Sh "B::BINOP \s-1METHOD\s0"
.IX Subsection "B::BINOP METHOD"
.PD 0
.IP "last" 4
.IX Item "last"
.PD
.Sh "B::LOGOP \s-1METHOD\s0"
.IX Subsection "B::LOGOP METHOD"
.IP "other" 4
.IX Item "other"
.Sh "B::LISTOP \s-1METHOD\s0"
.IX Subsection "B::LISTOP METHOD"
.PD 0
.IP "children" 4
.IX Item "children"
.PD
.Sh "B::PMOP \s-1METHODS\s0"
.IX Subsection "B::PMOP METHODS"
.IP "pmreplroot" 4
.IX Item "pmreplroot"
.PD 0
.IP "pmreplstart" 4
.IX Item "pmreplstart"
.IP "pmnext" 4
.IX Item "pmnext"
.IP "pmregexp" 4
.IX Item "pmregexp"
.IP "pmflags" 4
.IX Item "pmflags"
.IP "pmdynflags" 4
.IX Item "pmdynflags"
.IP "pmpermflags" 4
.IX Item "pmpermflags"
.IP "precomp" 4
.IX Item "precomp"
.IP "pmoffet" 4
.IX Item "pmoffet"
.PD
Only when perl was compiled with ithreads.
.Sh "B::SVOP \s-1METHOD\s0"
.IX Subsection "B::SVOP METHOD"
.IP "sv" 4
.IX Item "sv"
.PD 0
.IP "gv" 4
.IX Item "gv"
.PD
.Sh "B::PADOP \s-1METHOD\s0"
.IX Subsection "B::PADOP METHOD"
.IP "padix" 4
.IX Item "padix"
.Sh "B::PVOP \s-1METHOD\s0"
.IX Subsection "B::PVOP METHOD"
.PD 0
.IP "pv" 4
.IX Item "pv"
.PD
.Sh "B::LOOP \s-1METHODS\s0"
.IX Subsection "B::LOOP METHODS"
.IP "redoop" 4
.IX Item "redoop"
.PD 0
.IP "nextop" 4
.IX Item "nextop"
.IP "lastop" 4
.IX Item "lastop"
.PD
.Sh "B::COP \s-1METHODS\s0"
.IX Subsection "B::COP METHODS"
.IP "label" 4
.IX Item "label"
.PD 0
.IP "stash" 4
.IX Item "stash"
.IP "file" 4
.IX Item "file"
.IP "cop_seq" 4
.IX Item "cop_seq"
.IP "arybase" 4
.IX Item "arybase"
.IP "line" 4
.IX Item "line"
.PD
.ie n .SH "FUNCTIONS EXPORTED BY ""B"""
.el .SH "FUNCTIONS EXPORTED BY \f(CWB\fP"
.IX Header "FUNCTIONS EXPORTED BY B"
The \f(CW\*(C`B\*(C'\fR module exports a variety of functions: some are simple
utility functions, others provide a Perl program with a way to
get an initial \*(L"handle\*(R" on an internal object.
.IP "main_cv" 4
.IX Item "main_cv"
Return the (faked) \s-1CV\s0 corresponding to the main part of the Perl
program.
.IP "init_av" 4
.IX Item "init_av"
Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1INIT\s0 blocks.
.IP "begin_av" 4
.IX Item "begin_av"
Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1BEGIN\s0 blocks.
.IP "end_av" 4
.IX Item "end_av"
Returns the \s-1AV\s0 object (i.e. in class B::AV) representing \s-1END\s0 blocks.
.IP "main_root" 4
.IX Item "main_root"
Returns the root op (i.e. an object in the appropriate B::OP\-derived
class) of the main part of the Perl program.
.IP "main_start" 4
.IX Item "main_start"
Returns the starting op of the main part of the Perl program.
.IP "comppadlist" 4
.IX Item "comppadlist"
Returns the \s-1AV\s0 object (i.e. in class B::AV) of the global comppadlist.
.IP "regex_padav" 4
.IX Item "regex_padav"
Only when perl was compiled with ithreads.
.IP "sv_undef" 4
.IX Item "sv_undef"
Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_undef\*(C'\fR.
.IP "sv_yes" 4
.IX Item "sv_yes"
Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_yes\*(C'\fR.
.IP "sv_no" 4
.IX Item "sv_no"
Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`sv_no\*(C'\fR.
.IP "amagic_generation" 4
.IX Item "amagic_generation"
Returns the \s-1SV\s0 object corresponding to the C variable \f(CW\*(C`amagic_generation\*(C'\fR.
.IP "walkoptree(\s-1OP\s0, \s-1METHOD\s0)" 4
.IX Item "walkoptree(OP, METHOD)"
Does a tree-walk of the syntax tree based at \s-1OP\s0 and calls \s-1METHOD\s0 on
each op it visits. Each node is visited before its children. If
\&\f(CW\*(C`walkoptree_debug\*(C'\fR (q.v.) has been called to turn debugging on then
the method \f(CW\*(C`walkoptree_debug\*(C'\fR is called on each op before \s-1METHOD\s0 is
called.
.IP "walkoptree_debug(\s-1DEBUG\s0)" 4
.IX Item "walkoptree_debug(DEBUG)"
Returns the current debugging flag for \f(CW\*(C`walkoptree\*(C'\fR. If the optional
\&\s-1DEBUG\s0 argument is non\-zero, it sets the debugging flag to that. See
the description of \f(CW\*(C`walkoptree\*(C'\fR above for what the debugging flag
does.
.IP "walksymtable(\s-1SYMREF\s0, \s-1METHOD\s0, \s-1RECURSE\s0, \s-1PREFIX\s0)" 4
.IX Item "walksymtable(SYMREF, METHOD, RECURSE, PREFIX)"
Walk the symbol table starting at \s-1SYMREF\s0 and call \s-1METHOD\s0 on each
symbol (a B::GV object) visited.  When the walk reaches package
symbols (such as \*(L"Foo::\*(R") it invokes \s-1RECURSE\s0, passing in the symbol
name, and only recurses into the package if that sub returns true.
.Sp
\&\s-1PREFIX\s0 is the name of the \s-1SYMREF\s0 you're walking.
.Sp
For example...
.Sp
.Vb 4
\&  # Walk CGI's symbol table calling print_subs on each symbol.
\&  # Only recurse into CGI::Util::
\&  walksymtable(\e%CGI::, 'print_subs', sub { $_[0] eq 'CGI::Util::' },
\&               'CGI::');
.Ve
.Sp
\&\fIprint_subs()\fR is a B::GV method you have declared.
.IP "svref_2object(\s-1SV\s0)" 4
.IX Item "svref_2object(SV)"
Takes any Perl variable and turns it into an object in the
appropriate B::OP\-derived or B::SV\-derived class. Apart from functions
such as \f(CW\*(C`main_root\*(C'\fR, this is the primary way to get an initial
\&\*(L"handle\*(R" on an internal perl data structure which can then be followed
with the other access methods.
.IP "ppname(\s-1OPNUM\s0)" 4
.IX Item "ppname(OPNUM)"
Return the \s-1PP\s0 function name (e.g. \*(L"pp_add\*(R") of op number \s-1OPNUM\s0.
.IP "hash(\s-1STR\s0)" 4
.IX Item "hash(STR)"
Returns a string in the form \*(L"0x...\*(R" representing the value of the
internal hash function used by perl on string \s-1STR\s0.
.IP "cast_I32(I)" 4
.IX Item "cast_I32(I)"
Casts I to the internal I32 type used by that perl.
.IP "minus_c" 4
.IX Item "minus_c"
Does the equivalent of the \f(CW\*(C`\-c\*(C'\fR command-line option. Obviously, this
is only useful in a \s-1BEGIN\s0 block or else the flag is set too late.
.IP "cstring(\s-1STR\s0)" 4
.IX Item "cstring(STR)"
Returns a double-quote-surrounded escaped version of \s-1STR\s0 which can
be used as a string in C source code.
.IP "perlstring(\s-1STR\s0)" 4
.IX Item "perlstring(STR)"
Returns a double-quote-surrounded escaped version of \s-1STR\s0 which can
be used as a string in Perl source code.
.IP "class(\s-1OBJ\s0)" 4
.IX Item "class(OBJ)"
Returns the class of an object without the part of the classname
preceding the first \*(L"::\*(R". This is used to turn \*(L"B::UNOP\*(R" into
\&\*(L"\s-1UNOP\s0\*(R" for example.
.IP "threadsv_names" 4
.IX Item "threadsv_names"
In a perl compiled for threads, this returns a list of the special
per-thread threadsv variables.
.SH "AUTHOR"
.IX Header "AUTHOR"
Malcolm Beattie, \f(CW\*(C`mbeattie@sable.ox.ac.uk\*(C'\fR

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.