xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/ext/B/B.pm (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#      B.pm
2*0Sstevel@tonic-gate#
3*0Sstevel@tonic-gate#      Copyright (c) 1996, 1997, 1998 Malcolm Beattie
4*0Sstevel@tonic-gate#
5*0Sstevel@tonic-gate#      You may distribute under the terms of either the GNU General Public
6*0Sstevel@tonic-gate#      License or the Artistic License, as specified in the README file.
7*0Sstevel@tonic-gate#
8*0Sstevel@tonic-gatepackage B;
9*0Sstevel@tonic-gate
10*0Sstevel@tonic-gateour $VERSION = '1.02';
11*0Sstevel@tonic-gate
12*0Sstevel@tonic-gateuse XSLoader ();
13*0Sstevel@tonic-gaterequire Exporter;
14*0Sstevel@tonic-gate@ISA = qw(Exporter);
15*0Sstevel@tonic-gate
16*0Sstevel@tonic-gate# walkoptree_slow comes from B.pm (you are there),
17*0Sstevel@tonic-gate# walkoptree comes from B.xs
18*0Sstevel@tonic-gate@EXPORT_OK = qw(minus_c ppname save_BEGINs
19*0Sstevel@tonic-gate		class peekop cast_I32 cstring cchar hash threadsv_names
20*0Sstevel@tonic-gate		main_root main_start main_cv svref_2object opnumber
21*0Sstevel@tonic-gate		amagic_generation perlstring
22*0Sstevel@tonic-gate		walkoptree_slow walkoptree walkoptree_exec walksymtable
23*0Sstevel@tonic-gate		parents comppadlist sv_undef compile_stats timing_info
24*0Sstevel@tonic-gate		begin_av init_av check_av end_av regex_padav dowarn
25*0Sstevel@tonic-gate		defstash curstash warnhook diehook inc_gv
26*0Sstevel@tonic-gate		);
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gatesub OPf_KIDS ();
29*0Sstevel@tonic-gateuse strict;
30*0Sstevel@tonic-gate@B::SV::ISA = 'B::OBJECT';
31*0Sstevel@tonic-gate@B::NULL::ISA = 'B::SV';
32*0Sstevel@tonic-gate@B::PV::ISA = 'B::SV';
33*0Sstevel@tonic-gate@B::IV::ISA = 'B::SV';
34*0Sstevel@tonic-gate@B::NV::ISA = 'B::IV';
35*0Sstevel@tonic-gate@B::RV::ISA = 'B::SV';
36*0Sstevel@tonic-gate@B::PVIV::ISA = qw(B::PV B::IV);
37*0Sstevel@tonic-gate@B::PVNV::ISA = qw(B::PV B::NV);
38*0Sstevel@tonic-gate@B::PVMG::ISA = 'B::PVNV';
39*0Sstevel@tonic-gate@B::PVLV::ISA = 'B::PVMG';
40*0Sstevel@tonic-gate@B::BM::ISA = 'B::PVMG';
41*0Sstevel@tonic-gate@B::AV::ISA = 'B::PVMG';
42*0Sstevel@tonic-gate@B::GV::ISA = 'B::PVMG';
43*0Sstevel@tonic-gate@B::HV::ISA = 'B::PVMG';
44*0Sstevel@tonic-gate@B::CV::ISA = 'B::PVMG';
45*0Sstevel@tonic-gate@B::IO::ISA = 'B::PVMG';
46*0Sstevel@tonic-gate@B::FM::ISA = 'B::CV';
47*0Sstevel@tonic-gate
48*0Sstevel@tonic-gate@B::OP::ISA = 'B::OBJECT';
49*0Sstevel@tonic-gate@B::UNOP::ISA = 'B::OP';
50*0Sstevel@tonic-gate@B::BINOP::ISA = 'B::UNOP';
51*0Sstevel@tonic-gate@B::LOGOP::ISA = 'B::UNOP';
52*0Sstevel@tonic-gate@B::LISTOP::ISA = 'B::BINOP';
53*0Sstevel@tonic-gate@B::SVOP::ISA = 'B::OP';
54*0Sstevel@tonic-gate@B::PADOP::ISA = 'B::OP';
55*0Sstevel@tonic-gate@B::PVOP::ISA = 'B::OP';
56*0Sstevel@tonic-gate@B::LOOP::ISA = 'B::LISTOP';
57*0Sstevel@tonic-gate@B::PMOP::ISA = 'B::LISTOP';
58*0Sstevel@tonic-gate@B::COP::ISA = 'B::OP';
59*0Sstevel@tonic-gate
60*0Sstevel@tonic-gate@B::SPECIAL::ISA = 'B::OBJECT';
61*0Sstevel@tonic-gate
62*0Sstevel@tonic-gate{
63*0Sstevel@tonic-gate    # Stop "-w" from complaining about the lack of a real B::OBJECT class
64*0Sstevel@tonic-gate    package B::OBJECT;
65*0Sstevel@tonic-gate}
66*0Sstevel@tonic-gate
67*0Sstevel@tonic-gatesub B::GV::SAFENAME {
68*0Sstevel@tonic-gate  my $name = (shift())->NAME;
69*0Sstevel@tonic-gate
70*0Sstevel@tonic-gate  # The regex below corresponds to the isCONTROLVAR macro
71*0Sstevel@tonic-gate  # from toke.c
72*0Sstevel@tonic-gate
73*0Sstevel@tonic-gate  $name =~ s/^([\cA-\cZ\c\\c[\c]\c?\c_\c^])/"^".
74*0Sstevel@tonic-gate	chr( utf8::unicode_to_native( 64 ^ ord($1) ))/e;
75*0Sstevel@tonic-gate
76*0Sstevel@tonic-gate  # When we say unicode_to_native we really mean ascii_to_native,
77*0Sstevel@tonic-gate  # which matters iff this is a non-ASCII platform (EBCDIC).
78*0Sstevel@tonic-gate
79*0Sstevel@tonic-gate  return $name;
80*0Sstevel@tonic-gate}
81*0Sstevel@tonic-gate
82*0Sstevel@tonic-gatesub B::IV::int_value {
83*0Sstevel@tonic-gate  my ($self) = @_;
84*0Sstevel@tonic-gate  return (($self->FLAGS() & SVf_IVisUV()) ? $self->UVX : $self->IV);
85*0Sstevel@tonic-gate}
86*0Sstevel@tonic-gate
87*0Sstevel@tonic-gatesub B::NULL::as_string() {""}
88*0Sstevel@tonic-gatesub B::IV::as_string()   {goto &B::IV::int_value}
89*0Sstevel@tonic-gatesub B::PV::as_string()   {goto &B::PV::PV}
90*0Sstevel@tonic-gate
91*0Sstevel@tonic-gatemy $debug;
92*0Sstevel@tonic-gatemy $op_count = 0;
93*0Sstevel@tonic-gatemy @parents = ();
94*0Sstevel@tonic-gate
95*0Sstevel@tonic-gatesub debug {
96*0Sstevel@tonic-gate    my ($class, $value) = @_;
97*0Sstevel@tonic-gate    $debug = $value;
98*0Sstevel@tonic-gate    walkoptree_debug($value);
99*0Sstevel@tonic-gate}
100*0Sstevel@tonic-gate
101*0Sstevel@tonic-gatesub class {
102*0Sstevel@tonic-gate    my $obj = shift;
103*0Sstevel@tonic-gate    my $name = ref $obj;
104*0Sstevel@tonic-gate    $name =~ s/^.*:://;
105*0Sstevel@tonic-gate    return $name;
106*0Sstevel@tonic-gate}
107*0Sstevel@tonic-gate
108*0Sstevel@tonic-gatesub parents { \@parents }
109*0Sstevel@tonic-gate
110*0Sstevel@tonic-gate# For debugging
111*0Sstevel@tonic-gatesub peekop {
112*0Sstevel@tonic-gate    my $op = shift;
113*0Sstevel@tonic-gate    return sprintf("%s (0x%x) %s", class($op), $$op, $op->name);
114*0Sstevel@tonic-gate}
115*0Sstevel@tonic-gate
116*0Sstevel@tonic-gatesub walkoptree_slow {
117*0Sstevel@tonic-gate    my($op, $method, $level) = @_;
118*0Sstevel@tonic-gate    $op_count++; # just for statistics
119*0Sstevel@tonic-gate    $level ||= 0;
120*0Sstevel@tonic-gate    warn(sprintf("walkoptree: %d. %s\n", $level, peekop($op))) if $debug;
121*0Sstevel@tonic-gate    $op->$method($level);
122*0Sstevel@tonic-gate    if ($$op && ($op->flags & OPf_KIDS)) {
123*0Sstevel@tonic-gate	my $kid;
124*0Sstevel@tonic-gate	unshift(@parents, $op);
125*0Sstevel@tonic-gate	for ($kid = $op->first; $$kid; $kid = $kid->sibling) {
126*0Sstevel@tonic-gate	    walkoptree_slow($kid, $method, $level + 1);
127*0Sstevel@tonic-gate	}
128*0Sstevel@tonic-gate	shift @parents;
129*0Sstevel@tonic-gate    }
130*0Sstevel@tonic-gate    if (class($op) eq 'PMOP' && $op->pmreplroot && ${$op->pmreplroot}) {
131*0Sstevel@tonic-gate	unshift(@parents, $op);
132*0Sstevel@tonic-gate	walkoptree_slow($op->pmreplroot, $method, $level + 1);
133*0Sstevel@tonic-gate	shift @parents;
134*0Sstevel@tonic-gate    }
135*0Sstevel@tonic-gate}
136*0Sstevel@tonic-gate
137*0Sstevel@tonic-gatesub compile_stats {
138*0Sstevel@tonic-gate    return "Total number of OPs processed: $op_count\n";
139*0Sstevel@tonic-gate}
140*0Sstevel@tonic-gate
141*0Sstevel@tonic-gatesub timing_info {
142*0Sstevel@tonic-gate    my ($sec, $min, $hr) = localtime;
143*0Sstevel@tonic-gate    my ($user, $sys) = times;
144*0Sstevel@tonic-gate    sprintf("%02d:%02d:%02d user=$user sys=$sys",
145*0Sstevel@tonic-gate	    $hr, $min, $sec, $user, $sys);
146*0Sstevel@tonic-gate}
147*0Sstevel@tonic-gate
148*0Sstevel@tonic-gatemy %symtable;
149*0Sstevel@tonic-gate
150*0Sstevel@tonic-gatesub clearsym {
151*0Sstevel@tonic-gate    %symtable = ();
152*0Sstevel@tonic-gate}
153*0Sstevel@tonic-gate
154*0Sstevel@tonic-gatesub savesym {
155*0Sstevel@tonic-gate    my ($obj, $value) = @_;
156*0Sstevel@tonic-gate#    warn(sprintf("savesym: sym_%x => %s\n", $$obj, $value)); # debug
157*0Sstevel@tonic-gate    $symtable{sprintf("sym_%x", $$obj)} = $value;
158*0Sstevel@tonic-gate}
159*0Sstevel@tonic-gate
160*0Sstevel@tonic-gatesub objsym {
161*0Sstevel@tonic-gate    my $obj = shift;
162*0Sstevel@tonic-gate    return $symtable{sprintf("sym_%x", $$obj)};
163*0Sstevel@tonic-gate}
164*0Sstevel@tonic-gate
165*0Sstevel@tonic-gatesub walkoptree_exec {
166*0Sstevel@tonic-gate    my ($op, $method, $level) = @_;
167*0Sstevel@tonic-gate    $level ||= 0;
168*0Sstevel@tonic-gate    my ($sym, $ppname);
169*0Sstevel@tonic-gate    my $prefix = "    " x $level;
170*0Sstevel@tonic-gate    for (; $$op; $op = $op->next) {
171*0Sstevel@tonic-gate	$sym = objsym($op);
172*0Sstevel@tonic-gate	if (defined($sym)) {
173*0Sstevel@tonic-gate	    print $prefix, "goto $sym\n";
174*0Sstevel@tonic-gate	    return;
175*0Sstevel@tonic-gate	}
176*0Sstevel@tonic-gate	savesym($op, sprintf("%s (0x%lx)", class($op), $$op));
177*0Sstevel@tonic-gate	$op->$method($level);
178*0Sstevel@tonic-gate	$ppname = $op->name;
179*0Sstevel@tonic-gate	if ($ppname =~
180*0Sstevel@tonic-gate	    /^(or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/)
181*0Sstevel@tonic-gate	{
182*0Sstevel@tonic-gate	    print $prefix, uc($1), " => {\n";
183*0Sstevel@tonic-gate	    walkoptree_exec($op->other, $method, $level + 1);
184*0Sstevel@tonic-gate	    print $prefix, "}\n";
185*0Sstevel@tonic-gate	} elsif ($ppname eq "match" || $ppname eq "subst") {
186*0Sstevel@tonic-gate	    my $pmreplstart = $op->pmreplstart;
187*0Sstevel@tonic-gate	    if ($$pmreplstart) {
188*0Sstevel@tonic-gate		print $prefix, "PMREPLSTART => {\n";
189*0Sstevel@tonic-gate		walkoptree_exec($pmreplstart, $method, $level + 1);
190*0Sstevel@tonic-gate		print $prefix, "}\n";
191*0Sstevel@tonic-gate	    }
192*0Sstevel@tonic-gate	} elsif ($ppname eq "substcont") {
193*0Sstevel@tonic-gate	    print $prefix, "SUBSTCONT => {\n";
194*0Sstevel@tonic-gate	    walkoptree_exec($op->other->pmreplstart, $method, $level + 1);
195*0Sstevel@tonic-gate	    print $prefix, "}\n";
196*0Sstevel@tonic-gate	    $op = $op->other;
197*0Sstevel@tonic-gate	} elsif ($ppname eq "enterloop") {
198*0Sstevel@tonic-gate	    print $prefix, "REDO => {\n";
199*0Sstevel@tonic-gate	    walkoptree_exec($op->redoop, $method, $level + 1);
200*0Sstevel@tonic-gate	    print $prefix, "}\n", $prefix, "NEXT => {\n";
201*0Sstevel@tonic-gate	    walkoptree_exec($op->nextop, $method, $level + 1);
202*0Sstevel@tonic-gate	    print $prefix, "}\n", $prefix, "LAST => {\n";
203*0Sstevel@tonic-gate	    walkoptree_exec($op->lastop,  $method, $level + 1);
204*0Sstevel@tonic-gate	    print $prefix, "}\n";
205*0Sstevel@tonic-gate	} elsif ($ppname eq "subst") {
206*0Sstevel@tonic-gate	    my $replstart = $op->pmreplstart;
207*0Sstevel@tonic-gate	    if ($$replstart) {
208*0Sstevel@tonic-gate		print $prefix, "SUBST => {\n";
209*0Sstevel@tonic-gate		walkoptree_exec($replstart, $method, $level + 1);
210*0Sstevel@tonic-gate		print $prefix, "}\n";
211*0Sstevel@tonic-gate	    }
212*0Sstevel@tonic-gate	}
213*0Sstevel@tonic-gate    }
214*0Sstevel@tonic-gate}
215*0Sstevel@tonic-gate
216*0Sstevel@tonic-gatesub walksymtable {
217*0Sstevel@tonic-gate    my ($symref, $method, $recurse, $prefix) = @_;
218*0Sstevel@tonic-gate    my $sym;
219*0Sstevel@tonic-gate    my $ref;
220*0Sstevel@tonic-gate    my $fullname;
221*0Sstevel@tonic-gate    no strict 'refs';
222*0Sstevel@tonic-gate    $prefix = '' unless defined $prefix;
223*0Sstevel@tonic-gate    while (($sym, $ref) = each %$symref) {
224*0Sstevel@tonic-gate        $fullname = "*main::".$prefix.$sym;
225*0Sstevel@tonic-gate	if ($sym =~ /::$/) {
226*0Sstevel@tonic-gate	    $sym = $prefix . $sym;
227*0Sstevel@tonic-gate	    if ($sym ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
228*0Sstevel@tonic-gate               walksymtable(\%$fullname, $method, $recurse, $sym);
229*0Sstevel@tonic-gate	    }
230*0Sstevel@tonic-gate	} else {
231*0Sstevel@tonic-gate           svref_2object(\*$fullname)->$method();
232*0Sstevel@tonic-gate	}
233*0Sstevel@tonic-gate    }
234*0Sstevel@tonic-gate}
235*0Sstevel@tonic-gate
236*0Sstevel@tonic-gate{
237*0Sstevel@tonic-gate    package B::Section;
238*0Sstevel@tonic-gate    my $output_fh;
239*0Sstevel@tonic-gate    my %sections;
240*0Sstevel@tonic-gate
241*0Sstevel@tonic-gate    sub new {
242*0Sstevel@tonic-gate	my ($class, $section, $symtable, $default) = @_;
243*0Sstevel@tonic-gate	$output_fh ||= FileHandle->new_tmpfile;
244*0Sstevel@tonic-gate	my $obj = bless [-1, $section, $symtable, $default], $class;
245*0Sstevel@tonic-gate	$sections{$section} = $obj;
246*0Sstevel@tonic-gate	return $obj;
247*0Sstevel@tonic-gate    }
248*0Sstevel@tonic-gate
249*0Sstevel@tonic-gate    sub get {
250*0Sstevel@tonic-gate	my ($class, $section) = @_;
251*0Sstevel@tonic-gate	return $sections{$section};
252*0Sstevel@tonic-gate    }
253*0Sstevel@tonic-gate
254*0Sstevel@tonic-gate    sub add {
255*0Sstevel@tonic-gate	my $section = shift;
256*0Sstevel@tonic-gate	while (defined($_ = shift)) {
257*0Sstevel@tonic-gate	    print $output_fh "$section->[1]\t$_\n";
258*0Sstevel@tonic-gate	    $section->[0]++;
259*0Sstevel@tonic-gate	}
260*0Sstevel@tonic-gate    }
261*0Sstevel@tonic-gate
262*0Sstevel@tonic-gate    sub index {
263*0Sstevel@tonic-gate	my $section = shift;
264*0Sstevel@tonic-gate	return $section->[0];
265*0Sstevel@tonic-gate    }
266*0Sstevel@tonic-gate
267*0Sstevel@tonic-gate    sub name {
268*0Sstevel@tonic-gate	my $section = shift;
269*0Sstevel@tonic-gate	return $section->[1];
270*0Sstevel@tonic-gate    }
271*0Sstevel@tonic-gate
272*0Sstevel@tonic-gate    sub symtable {
273*0Sstevel@tonic-gate	my $section = shift;
274*0Sstevel@tonic-gate	return $section->[2];
275*0Sstevel@tonic-gate    }
276*0Sstevel@tonic-gate
277*0Sstevel@tonic-gate    sub default {
278*0Sstevel@tonic-gate	my $section = shift;
279*0Sstevel@tonic-gate	return $section->[3];
280*0Sstevel@tonic-gate    }
281*0Sstevel@tonic-gate
282*0Sstevel@tonic-gate    sub output {
283*0Sstevel@tonic-gate	my ($section, $fh, $format) = @_;
284*0Sstevel@tonic-gate	my $name = $section->name;
285*0Sstevel@tonic-gate	my $sym = $section->symtable || {};
286*0Sstevel@tonic-gate	my $default = $section->default;
287*0Sstevel@tonic-gate
288*0Sstevel@tonic-gate	seek($output_fh, 0, 0);
289*0Sstevel@tonic-gate	while (<$output_fh>) {
290*0Sstevel@tonic-gate	    chomp;
291*0Sstevel@tonic-gate	    s/^(.*?)\t//;
292*0Sstevel@tonic-gate	    if ($1 eq $name) {
293*0Sstevel@tonic-gate		s{(s\\_[0-9a-f]+)} {
294*0Sstevel@tonic-gate		    exists($sym->{$1}) ? $sym->{$1} : $default;
295*0Sstevel@tonic-gate		}ge;
296*0Sstevel@tonic-gate		printf $fh $format, $_;
297*0Sstevel@tonic-gate	    }
298*0Sstevel@tonic-gate	}
299*0Sstevel@tonic-gate    }
300*0Sstevel@tonic-gate}
301*0Sstevel@tonic-gate
302*0Sstevel@tonic-gateXSLoader::load 'B';
303*0Sstevel@tonic-gate
304*0Sstevel@tonic-gate1;
305*0Sstevel@tonic-gate
306*0Sstevel@tonic-gate__END__
307*0Sstevel@tonic-gate
308*0Sstevel@tonic-gate=head1 NAME
309*0Sstevel@tonic-gate
310*0Sstevel@tonic-gateB - The Perl Compiler
311*0Sstevel@tonic-gate
312*0Sstevel@tonic-gate=head1 SYNOPSIS
313*0Sstevel@tonic-gate
314*0Sstevel@tonic-gate	use B;
315*0Sstevel@tonic-gate
316*0Sstevel@tonic-gate=head1 DESCRIPTION
317*0Sstevel@tonic-gate
318*0Sstevel@tonic-gateThe C<B> module supplies classes which allow a Perl program to delve
319*0Sstevel@tonic-gateinto its own innards. It is the module used to implement the
320*0Sstevel@tonic-gate"backends" of the Perl compiler. Usage of the compiler does not
321*0Sstevel@tonic-gaterequire knowledge of this module: see the F<O> module for the
322*0Sstevel@tonic-gateuser-visible part. The C<B> module is of use to those who want to
323*0Sstevel@tonic-gatewrite new compiler backends. This documentation assumes that the
324*0Sstevel@tonic-gatereader knows a fair amount about perl's internals including such
325*0Sstevel@tonic-gatethings as SVs, OPs and the internal symbol table and syntax tree
326*0Sstevel@tonic-gateof a program.
327*0Sstevel@tonic-gate
328*0Sstevel@tonic-gate=head1 OVERVIEW
329*0Sstevel@tonic-gate
330*0Sstevel@tonic-gateThe C<B> module contains a set of utility functions for querying the
331*0Sstevel@tonic-gatecurrent state of the Perl interpreter; typically these functions
332*0Sstevel@tonic-gatereturn objects from the B::SV and B::OP classes, or their derived
333*0Sstevel@tonic-gateclasses.  These classes in turn define methods for querying the
334*0Sstevel@tonic-gateresulting objects about their own internal state.
335*0Sstevel@tonic-gate
336*0Sstevel@tonic-gate=head1 Utility Functions
337*0Sstevel@tonic-gate
338*0Sstevel@tonic-gateThe C<B> module exports a variety of functions: some are simple
339*0Sstevel@tonic-gateutility functions, others provide a Perl program with a way to
340*0Sstevel@tonic-gateget an initial "handle" on an internal object.
341*0Sstevel@tonic-gate
342*0Sstevel@tonic-gate=head2 Functions Returning C<B::SV>, C<B::AV>, C<B::HV>, and C<B::CV> objects
343*0Sstevel@tonic-gate
344*0Sstevel@tonic-gateFor descriptions of the class hierachy of these objects and the
345*0Sstevel@tonic-gatemethods that can be called on them, see below, L<"OVERVIEW OF
346*0Sstevel@tonic-gateCLASSES"> and L<"SV-RELATED CLASSES">.
347*0Sstevel@tonic-gate
348*0Sstevel@tonic-gate=over 4
349*0Sstevel@tonic-gate
350*0Sstevel@tonic-gate=item sv_undef
351*0Sstevel@tonic-gate
352*0Sstevel@tonic-gateReturns the SV object corresponding to the C variable C<sv_undef>.
353*0Sstevel@tonic-gate
354*0Sstevel@tonic-gate=item sv_yes
355*0Sstevel@tonic-gate
356*0Sstevel@tonic-gateReturns the SV object corresponding to the C variable C<sv_yes>.
357*0Sstevel@tonic-gate
358*0Sstevel@tonic-gate=item sv_no
359*0Sstevel@tonic-gate
360*0Sstevel@tonic-gateReturns the SV object corresponding to the C variable C<sv_no>.
361*0Sstevel@tonic-gate
362*0Sstevel@tonic-gate=item svref_2object(SVREF)
363*0Sstevel@tonic-gate
364*0Sstevel@tonic-gateTakes a reference to any Perl value, and turns the referred-to value
365*0Sstevel@tonic-gateinto an object in the appropriate B::OP-derived or B::SV-derived
366*0Sstevel@tonic-gateclass. Apart from functions such as C<main_root>, this is the primary
367*0Sstevel@tonic-gateway to get an initial "handle" on an internal perl data structure
368*0Sstevel@tonic-gatewhich can then be followed with the other access methods.
369*0Sstevel@tonic-gate
370*0Sstevel@tonic-gate=item amagic_generation
371*0Sstevel@tonic-gate
372*0Sstevel@tonic-gateReturns the SV object corresponding to the C variable C<amagic_generation>.
373*0Sstevel@tonic-gate
374*0Sstevel@tonic-gate=item init_av
375*0Sstevel@tonic-gate
376*0Sstevel@tonic-gateReturns the AV object (i.e. in class B::AV) representing INIT blocks.
377*0Sstevel@tonic-gate
378*0Sstevel@tonic-gate=item check_av
379*0Sstevel@tonic-gate
380*0Sstevel@tonic-gateReturns the AV object (i.e. in class B::AV) representing CHECK blocks.
381*0Sstevel@tonic-gate
382*0Sstevel@tonic-gate=item begin_av
383*0Sstevel@tonic-gate
384*0Sstevel@tonic-gateReturns the AV object (i.e. in class B::AV) representing BEGIN blocks.
385*0Sstevel@tonic-gate
386*0Sstevel@tonic-gate=item end_av
387*0Sstevel@tonic-gate
388*0Sstevel@tonic-gateReturns the AV object (i.e. in class B::AV) representing END blocks.
389*0Sstevel@tonic-gate
390*0Sstevel@tonic-gate=item comppadlist
391*0Sstevel@tonic-gate
392*0Sstevel@tonic-gateReturns the AV object (i.e. in class B::AV) of the global comppadlist.
393*0Sstevel@tonic-gate
394*0Sstevel@tonic-gate=item regex_padav
395*0Sstevel@tonic-gate
396*0Sstevel@tonic-gateOnly when perl was compiled with ithreads.
397*0Sstevel@tonic-gate
398*0Sstevel@tonic-gate=item main_cv
399*0Sstevel@tonic-gate
400*0Sstevel@tonic-gateReturn the (faked) CV corresponding to the main part of the Perl
401*0Sstevel@tonic-gateprogram.
402*0Sstevel@tonic-gate
403*0Sstevel@tonic-gate=back
404*0Sstevel@tonic-gate
405*0Sstevel@tonic-gate=head2 Functions for Examining the Symbol Table
406*0Sstevel@tonic-gate
407*0Sstevel@tonic-gate=over 4
408*0Sstevel@tonic-gate
409*0Sstevel@tonic-gate=item walksymtable(SYMREF, METHOD, RECURSE, PREFIX)
410*0Sstevel@tonic-gate
411*0Sstevel@tonic-gateWalk the symbol table starting at SYMREF and call METHOD on each
412*0Sstevel@tonic-gatesymbol (a B::GV object) visited.  When the walk reaches package
413*0Sstevel@tonic-gatesymbols (such as "Foo::") it invokes RECURSE, passing in the symbol
414*0Sstevel@tonic-gatename, and only recurses into the package if that sub returns true.
415*0Sstevel@tonic-gate
416*0Sstevel@tonic-gatePREFIX is the name of the SYMREF you're walking.
417*0Sstevel@tonic-gate
418*0Sstevel@tonic-gateFor example:
419*0Sstevel@tonic-gate
420*0Sstevel@tonic-gate  # Walk CGI's symbol table calling print_subs on each symbol.
421*0Sstevel@tonic-gate  # Recurse only into CGI::Util::
422*0Sstevel@tonic-gate  walksymtable(\%CGI::, 'print_subs', sub { $_[0] eq 'CGI::Util::' },
423*0Sstevel@tonic-gate               'CGI::');
424*0Sstevel@tonic-gate
425*0Sstevel@tonic-gateprint_subs() is a B::GV method you have declared. Also see L<"B::GV
426*0Sstevel@tonic-gateMethods">, below.
427*0Sstevel@tonic-gate
428*0Sstevel@tonic-gate=back
429*0Sstevel@tonic-gate
430*0Sstevel@tonic-gate=head2 Functions Returning C<B::OP> objects or for walking op trees
431*0Sstevel@tonic-gate
432*0Sstevel@tonic-gateFor descriptions of the class hierachy of these objects and the
433*0Sstevel@tonic-gatemethods that can be called on them, see below, L<"OVERVIEW OF
434*0Sstevel@tonic-gateCLASSES"> and L<"OP-RELATED CLASSES">.
435*0Sstevel@tonic-gate
436*0Sstevel@tonic-gate=over 4
437*0Sstevel@tonic-gate
438*0Sstevel@tonic-gate=item main_root
439*0Sstevel@tonic-gate
440*0Sstevel@tonic-gateReturns the root op (i.e. an object in the appropriate B::OP-derived
441*0Sstevel@tonic-gateclass) of the main part of the Perl program.
442*0Sstevel@tonic-gate
443*0Sstevel@tonic-gate=item main_start
444*0Sstevel@tonic-gate
445*0Sstevel@tonic-gateReturns the starting op of the main part of the Perl program.
446*0Sstevel@tonic-gate
447*0Sstevel@tonic-gate=item walkoptree(OP, METHOD)
448*0Sstevel@tonic-gate
449*0Sstevel@tonic-gateDoes a tree-walk of the syntax tree based at OP and calls METHOD on
450*0Sstevel@tonic-gateeach op it visits. Each node is visited before its children. If
451*0Sstevel@tonic-gateC<walkoptree_debug> (see below) has been called to turn debugging on then
452*0Sstevel@tonic-gatethe method C<walkoptree_debug> is called on each op before METHOD is
453*0Sstevel@tonic-gatecalled.
454*0Sstevel@tonic-gate
455*0Sstevel@tonic-gate=item walkoptree_debug(DEBUG)
456*0Sstevel@tonic-gate
457*0Sstevel@tonic-gateReturns the current debugging flag for C<walkoptree>. If the optional
458*0Sstevel@tonic-gateDEBUG argument is non-zero, it sets the debugging flag to that. See
459*0Sstevel@tonic-gatethe description of C<walkoptree> above for what the debugging flag
460*0Sstevel@tonic-gatedoes.
461*0Sstevel@tonic-gate
462*0Sstevel@tonic-gate=back
463*0Sstevel@tonic-gate
464*0Sstevel@tonic-gate=head2 Miscellaneous Utility Functions
465*0Sstevel@tonic-gate
466*0Sstevel@tonic-gate=over 4
467*0Sstevel@tonic-gate
468*0Sstevel@tonic-gate=item ppname(OPNUM)
469*0Sstevel@tonic-gate
470*0Sstevel@tonic-gateReturn the PP function name (e.g. "pp_add") of op number OPNUM.
471*0Sstevel@tonic-gate
472*0Sstevel@tonic-gate=item hash(STR)
473*0Sstevel@tonic-gate
474*0Sstevel@tonic-gateReturns a string in the form "0x..." representing the value of the
475*0Sstevel@tonic-gateinternal hash function used by perl on string STR.
476*0Sstevel@tonic-gate
477*0Sstevel@tonic-gate=item cast_I32(I)
478*0Sstevel@tonic-gate
479*0Sstevel@tonic-gateCasts I to the internal I32 type used by that perl.
480*0Sstevel@tonic-gate
481*0Sstevel@tonic-gate=item minus_c
482*0Sstevel@tonic-gate
483*0Sstevel@tonic-gateDoes the equivalent of the C<-c> command-line option. Obviously, this
484*0Sstevel@tonic-gateis only useful in a BEGIN block or else the flag is set too late.
485*0Sstevel@tonic-gate
486*0Sstevel@tonic-gate=item cstring(STR)
487*0Sstevel@tonic-gate
488*0Sstevel@tonic-gateReturns a double-quote-surrounded escaped version of STR which can
489*0Sstevel@tonic-gatebe used as a string in C source code.
490*0Sstevel@tonic-gate
491*0Sstevel@tonic-gate=item perlstring(STR)
492*0Sstevel@tonic-gate
493*0Sstevel@tonic-gateReturns a double-quote-surrounded escaped version of STR which can
494*0Sstevel@tonic-gatebe used as a string in Perl source code.
495*0Sstevel@tonic-gate
496*0Sstevel@tonic-gate=item class(OBJ)
497*0Sstevel@tonic-gate
498*0Sstevel@tonic-gateReturns the class of an object without the part of the classname
499*0Sstevel@tonic-gatepreceding the first C<"::">. This is used to turn C<"B::UNOP"> into
500*0Sstevel@tonic-gateC<"UNOP"> for example.
501*0Sstevel@tonic-gate
502*0Sstevel@tonic-gate=item threadsv_names
503*0Sstevel@tonic-gate
504*0Sstevel@tonic-gateIn a perl compiled for threads, this returns a list of the special
505*0Sstevel@tonic-gateper-thread threadsv variables.
506*0Sstevel@tonic-gate
507*0Sstevel@tonic-gate=back
508*0Sstevel@tonic-gate
509*0Sstevel@tonic-gate
510*0Sstevel@tonic-gate
511*0Sstevel@tonic-gate
512*0Sstevel@tonic-gate=head1 OVERVIEW OF CLASSES
513*0Sstevel@tonic-gate
514*0Sstevel@tonic-gateThe C structures used by Perl's internals to hold SV and OP
515*0Sstevel@tonic-gateinformation (PVIV, AV, HV, ..., OP, SVOP, UNOP, ...) are modelled on a
516*0Sstevel@tonic-gateclass hierarchy and the C<B> module gives access to them via a true
517*0Sstevel@tonic-gateobject hierarchy. Structure fields which point to other objects
518*0Sstevel@tonic-gate(whether types of SV or types of OP) are represented by the C<B>
519*0Sstevel@tonic-gatemodule as Perl objects of the appropriate class.
520*0Sstevel@tonic-gate
521*0Sstevel@tonic-gateThe bulk of the C<B> module is the methods for accessing fields of
522*0Sstevel@tonic-gatethese structures.
523*0Sstevel@tonic-gate
524*0Sstevel@tonic-gateNote that all access is read-only.  You cannot modify the internals by
525*0Sstevel@tonic-gateusing this module.
526*0Sstevel@tonic-gate
527*0Sstevel@tonic-gate=head2 SV-RELATED CLASSES
528*0Sstevel@tonic-gate
529*0Sstevel@tonic-gateB::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV,
530*0Sstevel@tonic-gateB::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in
531*0Sstevel@tonic-gatethe obvious way to the underlying C structures of similar names. The
532*0Sstevel@tonic-gateinheritance hierarchy mimics the underlying C "inheritance":
533*0Sstevel@tonic-gate
534*0Sstevel@tonic-gate                             B::SV
535*0Sstevel@tonic-gate                               |
536*0Sstevel@tonic-gate                +--------------+----------------------+
537*0Sstevel@tonic-gate                |              |                      |
538*0Sstevel@tonic-gate              B::PV          B::IV                  B::RV
539*0Sstevel@tonic-gate                |  \        /     \
540*0Sstevel@tonic-gate                |   \      /       \
541*0Sstevel@tonic-gate                |   B::PVIV         B::NV
542*0Sstevel@tonic-gate                 \                 /
543*0Sstevel@tonic-gate                  \____         __/
544*0Sstevel@tonic-gate                       \       /
545*0Sstevel@tonic-gate                        B::PVNV
546*0Sstevel@tonic-gate                           |
547*0Sstevel@tonic-gate                           |
548*0Sstevel@tonic-gate                        B::PVMG
549*0Sstevel@tonic-gate                           |
550*0Sstevel@tonic-gate         +------+-----+----+------+-----+-----+
551*0Sstevel@tonic-gate         |      |     |    |      |     |     |
552*0Sstevel@tonic-gate      B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO
553*0Sstevel@tonic-gate                                        |
554*0Sstevel@tonic-gate                                        |
555*0Sstevel@tonic-gate                                      B::FM
556*0Sstevel@tonic-gate
557*0Sstevel@tonic-gate
558*0Sstevel@tonic-gateAccess methods correspond to the underlying C macros for field access,
559*0Sstevel@tonic-gateusually with the leading "class indication" prefix removed (Sv, Av,
560*0Sstevel@tonic-gateHv, ...). The leading prefix is only left in cases where its removal
561*0Sstevel@tonic-gatewould cause a clash in method name. For example, C<GvREFCNT> stays
562*0Sstevel@tonic-gateas-is since its abbreviation would clash with the "superclass" method
563*0Sstevel@tonic-gateC<REFCNT> (corresponding to the C function C<SvREFCNT>).
564*0Sstevel@tonic-gate
565*0Sstevel@tonic-gate=head2 B::SV Methods
566*0Sstevel@tonic-gate
567*0Sstevel@tonic-gate=over 4
568*0Sstevel@tonic-gate
569*0Sstevel@tonic-gate=item REFCNT
570*0Sstevel@tonic-gate
571*0Sstevel@tonic-gate=item FLAGS
572*0Sstevel@tonic-gate
573*0Sstevel@tonic-gate=item object_2svref
574*0Sstevel@tonic-gate
575*0Sstevel@tonic-gateReturns a reference to the regular scalar corresponding to this
576*0Sstevel@tonic-gateB::SV object. In other words, this method is the inverse operation
577*0Sstevel@tonic-gateto the svref_2object() subroutine. This scalar and other data it points
578*0Sstevel@tonic-gateat should be considered read-only: modifying them is neither safe nor
579*0Sstevel@tonic-gateguaranteed to have a sensible effect.
580*0Sstevel@tonic-gate
581*0Sstevel@tonic-gate=back
582*0Sstevel@tonic-gate
583*0Sstevel@tonic-gate=head2 B::IV Methods
584*0Sstevel@tonic-gate
585*0Sstevel@tonic-gate=over 4
586*0Sstevel@tonic-gate
587*0Sstevel@tonic-gate=item IV
588*0Sstevel@tonic-gate
589*0Sstevel@tonic-gateReturns the value of the IV, I<interpreted as
590*0Sstevel@tonic-gatea signed integer>. This will be misleading
591*0Sstevel@tonic-gateif C<FLAGS & SVf_IVisUV>. Perhaps you want the
592*0Sstevel@tonic-gateC<int_value> method instead?
593*0Sstevel@tonic-gate
594*0Sstevel@tonic-gate=item IVX
595*0Sstevel@tonic-gate
596*0Sstevel@tonic-gate=item UVX
597*0Sstevel@tonic-gate
598*0Sstevel@tonic-gate=item int_value
599*0Sstevel@tonic-gate
600*0Sstevel@tonic-gateThis method returns the value of the IV as an integer.
601*0Sstevel@tonic-gateIt differs from C<IV> in that it returns the correct
602*0Sstevel@tonic-gatevalue regardless of whether it's stored signed or
603*0Sstevel@tonic-gateunsigned.
604*0Sstevel@tonic-gate
605*0Sstevel@tonic-gate=item needs64bits
606*0Sstevel@tonic-gate
607*0Sstevel@tonic-gate=item packiv
608*0Sstevel@tonic-gate
609*0Sstevel@tonic-gate=back
610*0Sstevel@tonic-gate
611*0Sstevel@tonic-gate=head2 B::NV Methods
612*0Sstevel@tonic-gate
613*0Sstevel@tonic-gate=over 4
614*0Sstevel@tonic-gate
615*0Sstevel@tonic-gate=item NV
616*0Sstevel@tonic-gate
617*0Sstevel@tonic-gate=item NVX
618*0Sstevel@tonic-gate
619*0Sstevel@tonic-gate=back
620*0Sstevel@tonic-gate
621*0Sstevel@tonic-gate=head2 B::RV Methods
622*0Sstevel@tonic-gate
623*0Sstevel@tonic-gate=over 4
624*0Sstevel@tonic-gate
625*0Sstevel@tonic-gate=item RV
626*0Sstevel@tonic-gate
627*0Sstevel@tonic-gate=back
628*0Sstevel@tonic-gate
629*0Sstevel@tonic-gate=head2 B::PV Methods
630*0Sstevel@tonic-gate
631*0Sstevel@tonic-gate=over 4
632*0Sstevel@tonic-gate
633*0Sstevel@tonic-gate=item PV
634*0Sstevel@tonic-gate
635*0Sstevel@tonic-gateThis method is the one you usually want. It constructs a
636*0Sstevel@tonic-gatestring using the length and offset information in the struct:
637*0Sstevel@tonic-gatefor ordinary scalars it will return the string that you'd see
638*0Sstevel@tonic-gatefrom Perl, even if it contains null characters.
639*0Sstevel@tonic-gate
640*0Sstevel@tonic-gate=item RV
641*0Sstevel@tonic-gate
642*0Sstevel@tonic-gateSame as B::RV::RV, except that it will die() if the PV isn't
643*0Sstevel@tonic-gatea reference.
644*0Sstevel@tonic-gate
645*0Sstevel@tonic-gate=item PVX
646*0Sstevel@tonic-gate
647*0Sstevel@tonic-gateThis method is less often useful. It assumes that the string
648*0Sstevel@tonic-gatestored in the struct is null-terminated, and disregards the
649*0Sstevel@tonic-gatelength information.
650*0Sstevel@tonic-gate
651*0Sstevel@tonic-gateIt is the appropriate method to use if you need to get the name
652*0Sstevel@tonic-gateof a lexical variable from a padname array. Lexical variable names
653*0Sstevel@tonic-gateare always stored with a null terminator, and the length field
654*0Sstevel@tonic-gate(SvCUR) is overloaded for other purposes and can't be relied on here.
655*0Sstevel@tonic-gate
656*0Sstevel@tonic-gate=back
657*0Sstevel@tonic-gate
658*0Sstevel@tonic-gate=head2 B::PVMG Methods
659*0Sstevel@tonic-gate
660*0Sstevel@tonic-gate=over 4
661*0Sstevel@tonic-gate
662*0Sstevel@tonic-gate=item MAGIC
663*0Sstevel@tonic-gate
664*0Sstevel@tonic-gate=item SvSTASH
665*0Sstevel@tonic-gate
666*0Sstevel@tonic-gate=back
667*0Sstevel@tonic-gate
668*0Sstevel@tonic-gate=head2 B::MAGIC Methods
669*0Sstevel@tonic-gate
670*0Sstevel@tonic-gate=over 4
671*0Sstevel@tonic-gate
672*0Sstevel@tonic-gate=item MOREMAGIC
673*0Sstevel@tonic-gate
674*0Sstevel@tonic-gate=item precomp
675*0Sstevel@tonic-gate
676*0Sstevel@tonic-gateOnly valid on r-magic, returns the string that generated the regexp.
677*0Sstevel@tonic-gate
678*0Sstevel@tonic-gate=item PRIVATE
679*0Sstevel@tonic-gate
680*0Sstevel@tonic-gate=item TYPE
681*0Sstevel@tonic-gate
682*0Sstevel@tonic-gate=item FLAGS
683*0Sstevel@tonic-gate
684*0Sstevel@tonic-gate=item OBJ
685*0Sstevel@tonic-gate
686*0Sstevel@tonic-gateWill die() if called on r-magic.
687*0Sstevel@tonic-gate
688*0Sstevel@tonic-gate=item PTR
689*0Sstevel@tonic-gate
690*0Sstevel@tonic-gate=item REGEX
691*0Sstevel@tonic-gate
692*0Sstevel@tonic-gateOnly valid on r-magic, returns the integer value of the REGEX stored
693*0Sstevel@tonic-gatein the MAGIC.
694*0Sstevel@tonic-gate
695*0Sstevel@tonic-gate=back
696*0Sstevel@tonic-gate
697*0Sstevel@tonic-gate=head2 B::PVLV Methods
698*0Sstevel@tonic-gate
699*0Sstevel@tonic-gate=over 4
700*0Sstevel@tonic-gate
701*0Sstevel@tonic-gate=item TARGOFF
702*0Sstevel@tonic-gate
703*0Sstevel@tonic-gate=item TARGLEN
704*0Sstevel@tonic-gate
705*0Sstevel@tonic-gate=item TYPE
706*0Sstevel@tonic-gate
707*0Sstevel@tonic-gate=item TARG
708*0Sstevel@tonic-gate
709*0Sstevel@tonic-gate=back
710*0Sstevel@tonic-gate
711*0Sstevel@tonic-gate=head2 B::BM Methods
712*0Sstevel@tonic-gate
713*0Sstevel@tonic-gate=over 4
714*0Sstevel@tonic-gate
715*0Sstevel@tonic-gate=item USEFUL
716*0Sstevel@tonic-gate
717*0Sstevel@tonic-gate=item PREVIOUS
718*0Sstevel@tonic-gate
719*0Sstevel@tonic-gate=item RARE
720*0Sstevel@tonic-gate
721*0Sstevel@tonic-gate=item TABLE
722*0Sstevel@tonic-gate
723*0Sstevel@tonic-gate=back
724*0Sstevel@tonic-gate
725*0Sstevel@tonic-gate=head2 B::GV Methods
726*0Sstevel@tonic-gate
727*0Sstevel@tonic-gate=over 4
728*0Sstevel@tonic-gate
729*0Sstevel@tonic-gate=item is_empty
730*0Sstevel@tonic-gate
731*0Sstevel@tonic-gateThis method returns TRUE if the GP field of the GV is NULL.
732*0Sstevel@tonic-gate
733*0Sstevel@tonic-gate=item NAME
734*0Sstevel@tonic-gate
735*0Sstevel@tonic-gate=item SAFENAME
736*0Sstevel@tonic-gate
737*0Sstevel@tonic-gateThis method returns the name of the glob, but if the first
738*0Sstevel@tonic-gatecharacter of the name is a control character, then it converts
739*0Sstevel@tonic-gateit to ^X first, so that *^G would return "^G" rather than "\cG".
740*0Sstevel@tonic-gate
741*0Sstevel@tonic-gateIt's useful if you want to print out the name of a variable.
742*0Sstevel@tonic-gateIf you restrict yourself to globs which exist at compile-time
743*0Sstevel@tonic-gatethen the result ought to be unambiguous, because code like
744*0Sstevel@tonic-gateC<${"^G"} = 1> is compiled as two ops - a constant string and
745*0Sstevel@tonic-gatea dereference (rv2gv) - so that the glob is created at runtime.
746*0Sstevel@tonic-gate
747*0Sstevel@tonic-gateIf you're working with globs at runtime, and need to disambiguate
748*0Sstevel@tonic-gate*^G from *{"^G"}, then you should use the raw NAME method.
749*0Sstevel@tonic-gate
750*0Sstevel@tonic-gate=item STASH
751*0Sstevel@tonic-gate
752*0Sstevel@tonic-gate=item SV
753*0Sstevel@tonic-gate
754*0Sstevel@tonic-gate=item IO
755*0Sstevel@tonic-gate
756*0Sstevel@tonic-gate=item FORM
757*0Sstevel@tonic-gate
758*0Sstevel@tonic-gate=item AV
759*0Sstevel@tonic-gate
760*0Sstevel@tonic-gate=item HV
761*0Sstevel@tonic-gate
762*0Sstevel@tonic-gate=item EGV
763*0Sstevel@tonic-gate
764*0Sstevel@tonic-gate=item CV
765*0Sstevel@tonic-gate
766*0Sstevel@tonic-gate=item CVGEN
767*0Sstevel@tonic-gate
768*0Sstevel@tonic-gate=item LINE
769*0Sstevel@tonic-gate
770*0Sstevel@tonic-gate=item FILE
771*0Sstevel@tonic-gate
772*0Sstevel@tonic-gate=item FILEGV
773*0Sstevel@tonic-gate
774*0Sstevel@tonic-gate=item GvREFCNT
775*0Sstevel@tonic-gate
776*0Sstevel@tonic-gate=item FLAGS
777*0Sstevel@tonic-gate
778*0Sstevel@tonic-gate=back
779*0Sstevel@tonic-gate
780*0Sstevel@tonic-gate=head2 B::IO Methods
781*0Sstevel@tonic-gate
782*0Sstevel@tonic-gate=over 4
783*0Sstevel@tonic-gate
784*0Sstevel@tonic-gate=item LINES
785*0Sstevel@tonic-gate
786*0Sstevel@tonic-gate=item PAGE
787*0Sstevel@tonic-gate
788*0Sstevel@tonic-gate=item PAGE_LEN
789*0Sstevel@tonic-gate
790*0Sstevel@tonic-gate=item LINES_LEFT
791*0Sstevel@tonic-gate
792*0Sstevel@tonic-gate=item TOP_NAME
793*0Sstevel@tonic-gate
794*0Sstevel@tonic-gate=item TOP_GV
795*0Sstevel@tonic-gate
796*0Sstevel@tonic-gate=item FMT_NAME
797*0Sstevel@tonic-gate
798*0Sstevel@tonic-gate=item FMT_GV
799*0Sstevel@tonic-gate
800*0Sstevel@tonic-gate=item BOTTOM_NAME
801*0Sstevel@tonic-gate
802*0Sstevel@tonic-gate=item BOTTOM_GV
803*0Sstevel@tonic-gate
804*0Sstevel@tonic-gate=item SUBPROCESS
805*0Sstevel@tonic-gate
806*0Sstevel@tonic-gate=item IoTYPE
807*0Sstevel@tonic-gate
808*0Sstevel@tonic-gate=item IoFLAGS
809*0Sstevel@tonic-gate
810*0Sstevel@tonic-gate=item IsSTD
811*0Sstevel@tonic-gate
812*0Sstevel@tonic-gateTakes one arguments ( 'stdin' | 'stdout' | 'stderr' ) and returns true
813*0Sstevel@tonic-gateif the IoIFP of the object is equal to the handle whose name was
814*0Sstevel@tonic-gatepassed as argument ( i.e. $io->IsSTD('stderr') is true if
815*0Sstevel@tonic-gateIoIFP($io) == PerlIO_stdin() ).
816*0Sstevel@tonic-gate
817*0Sstevel@tonic-gate=back
818*0Sstevel@tonic-gate
819*0Sstevel@tonic-gate=head2 B::AV Methods
820*0Sstevel@tonic-gate
821*0Sstevel@tonic-gate=over 4
822*0Sstevel@tonic-gate
823*0Sstevel@tonic-gate=item FILL
824*0Sstevel@tonic-gate
825*0Sstevel@tonic-gate=item MAX
826*0Sstevel@tonic-gate
827*0Sstevel@tonic-gate=item OFF
828*0Sstevel@tonic-gate
829*0Sstevel@tonic-gate=item ARRAY
830*0Sstevel@tonic-gate
831*0Sstevel@tonic-gate=item ARRAYelt
832*0Sstevel@tonic-gate
833*0Sstevel@tonic-gateLike C<ARRAY>, but takes an index as an argument to get only one element,
834*0Sstevel@tonic-gaterather than a list of all of them.
835*0Sstevel@tonic-gate
836*0Sstevel@tonic-gate=item AvFLAGS
837*0Sstevel@tonic-gate
838*0Sstevel@tonic-gate=back
839*0Sstevel@tonic-gate
840*0Sstevel@tonic-gate=head2 B::CV Methods
841*0Sstevel@tonic-gate
842*0Sstevel@tonic-gate=over 4
843*0Sstevel@tonic-gate
844*0Sstevel@tonic-gate=item STASH
845*0Sstevel@tonic-gate
846*0Sstevel@tonic-gate=item START
847*0Sstevel@tonic-gate
848*0Sstevel@tonic-gate=item ROOT
849*0Sstevel@tonic-gate
850*0Sstevel@tonic-gate=item GV
851*0Sstevel@tonic-gate
852*0Sstevel@tonic-gate=item FILE
853*0Sstevel@tonic-gate
854*0Sstevel@tonic-gate=item DEPTH
855*0Sstevel@tonic-gate
856*0Sstevel@tonic-gate=item PADLIST
857*0Sstevel@tonic-gate
858*0Sstevel@tonic-gate=item OUTSIDE
859*0Sstevel@tonic-gate
860*0Sstevel@tonic-gate=item OUTSIDE_SEQ
861*0Sstevel@tonic-gate
862*0Sstevel@tonic-gate=item XSUB
863*0Sstevel@tonic-gate
864*0Sstevel@tonic-gate=item XSUBANY
865*0Sstevel@tonic-gate
866*0Sstevel@tonic-gateFor constant subroutines, returns the constant SV returned by the subroutine.
867*0Sstevel@tonic-gate
868*0Sstevel@tonic-gate=item CvFLAGS
869*0Sstevel@tonic-gate
870*0Sstevel@tonic-gate=item const_sv
871*0Sstevel@tonic-gate
872*0Sstevel@tonic-gate=back
873*0Sstevel@tonic-gate
874*0Sstevel@tonic-gate=head2 B::HV Methods
875*0Sstevel@tonic-gate
876*0Sstevel@tonic-gate=over 4
877*0Sstevel@tonic-gate
878*0Sstevel@tonic-gate=item FILL
879*0Sstevel@tonic-gate
880*0Sstevel@tonic-gate=item MAX
881*0Sstevel@tonic-gate
882*0Sstevel@tonic-gate=item KEYS
883*0Sstevel@tonic-gate
884*0Sstevel@tonic-gate=item RITER
885*0Sstevel@tonic-gate
886*0Sstevel@tonic-gate=item NAME
887*0Sstevel@tonic-gate
888*0Sstevel@tonic-gate=item PMROOT
889*0Sstevel@tonic-gate
890*0Sstevel@tonic-gate=item ARRAY
891*0Sstevel@tonic-gate
892*0Sstevel@tonic-gate=back
893*0Sstevel@tonic-gate
894*0Sstevel@tonic-gate=head2 OP-RELATED CLASSES
895*0Sstevel@tonic-gate
896*0Sstevel@tonic-gateC<B::OP>, C<B::UNOP>, C<B::BINOP>, C<B::LOGOP>, C<B::LISTOP>, C<B::PMOP>,
897*0Sstevel@tonic-gateC<B::SVOP>, C<B::PADOP>, C<B::PVOP>, C<B::LOOP>, C<B::COP>.
898*0Sstevel@tonic-gate
899*0Sstevel@tonic-gateThese classes correspond in the obvious way to the underlying C
900*0Sstevel@tonic-gatestructures of similar names. The inheritance hierarchy mimics the
901*0Sstevel@tonic-gateunderlying C "inheritance":
902*0Sstevel@tonic-gate
903*0Sstevel@tonic-gate                                 B::OP
904*0Sstevel@tonic-gate                                   |
905*0Sstevel@tonic-gate                   +---------------+--------+--------+
906*0Sstevel@tonic-gate                   |               |        |        |
907*0Sstevel@tonic-gate                B::UNOP          B::SVOP B::PADOP  B::COP
908*0Sstevel@tonic-gate                 ,'  `-.
909*0Sstevel@tonic-gate                /       `--.
910*0Sstevel@tonic-gate           B::BINOP     B::LOGOP
911*0Sstevel@tonic-gate               |
912*0Sstevel@tonic-gate               |
913*0Sstevel@tonic-gate           B::LISTOP
914*0Sstevel@tonic-gate             ,' `.
915*0Sstevel@tonic-gate            /     \
916*0Sstevel@tonic-gate        B::LOOP B::PMOP
917*0Sstevel@tonic-gate
918*0Sstevel@tonic-gateAccess methods correspond to the underlying C structre field names,
919*0Sstevel@tonic-gatewith the leading "class indication" prefix (C<"op_">) removed.
920*0Sstevel@tonic-gate
921*0Sstevel@tonic-gate=head2 B::OP Methods
922*0Sstevel@tonic-gate
923*0Sstevel@tonic-gate=over 4
924*0Sstevel@tonic-gate
925*0Sstevel@tonic-gate=item next
926*0Sstevel@tonic-gate
927*0Sstevel@tonic-gate=item sibling
928*0Sstevel@tonic-gate
929*0Sstevel@tonic-gate=item name
930*0Sstevel@tonic-gate
931*0Sstevel@tonic-gateThis returns the op name as a string (e.g. "add", "rv2av").
932*0Sstevel@tonic-gate
933*0Sstevel@tonic-gate=item ppaddr
934*0Sstevel@tonic-gate
935*0Sstevel@tonic-gateThis returns the function name as a string (e.g. "PL_ppaddr[OP_ADD]",
936*0Sstevel@tonic-gate"PL_ppaddr[OP_RV2AV]").
937*0Sstevel@tonic-gate
938*0Sstevel@tonic-gate=item desc
939*0Sstevel@tonic-gate
940*0Sstevel@tonic-gateThis returns the op description from the global C PL_op_desc array
941*0Sstevel@tonic-gate(e.g. "addition" "array deref").
942*0Sstevel@tonic-gate
943*0Sstevel@tonic-gate=item targ
944*0Sstevel@tonic-gate
945*0Sstevel@tonic-gate=item type
946*0Sstevel@tonic-gate
947*0Sstevel@tonic-gate=item seq
948*0Sstevel@tonic-gate
949*0Sstevel@tonic-gate=item flags
950*0Sstevel@tonic-gate
951*0Sstevel@tonic-gate=item private
952*0Sstevel@tonic-gate
953*0Sstevel@tonic-gate=back
954*0Sstevel@tonic-gate
955*0Sstevel@tonic-gate=head2 B::UNOP METHOD
956*0Sstevel@tonic-gate
957*0Sstevel@tonic-gate=over 4
958*0Sstevel@tonic-gate
959*0Sstevel@tonic-gate=item first
960*0Sstevel@tonic-gate
961*0Sstevel@tonic-gate=back
962*0Sstevel@tonic-gate
963*0Sstevel@tonic-gate=head2 B::BINOP METHOD
964*0Sstevel@tonic-gate
965*0Sstevel@tonic-gate=over 4
966*0Sstevel@tonic-gate
967*0Sstevel@tonic-gate=item last
968*0Sstevel@tonic-gate
969*0Sstevel@tonic-gate=back
970*0Sstevel@tonic-gate
971*0Sstevel@tonic-gate=head2 B::LOGOP METHOD
972*0Sstevel@tonic-gate
973*0Sstevel@tonic-gate=over 4
974*0Sstevel@tonic-gate
975*0Sstevel@tonic-gate=item other
976*0Sstevel@tonic-gate
977*0Sstevel@tonic-gate=back
978*0Sstevel@tonic-gate
979*0Sstevel@tonic-gate=head2 B::LISTOP METHOD
980*0Sstevel@tonic-gate
981*0Sstevel@tonic-gate=over 4
982*0Sstevel@tonic-gate
983*0Sstevel@tonic-gate=item children
984*0Sstevel@tonic-gate
985*0Sstevel@tonic-gate=back
986*0Sstevel@tonic-gate
987*0Sstevel@tonic-gate=head2 B::PMOP Methods
988*0Sstevel@tonic-gate
989*0Sstevel@tonic-gate=over 4
990*0Sstevel@tonic-gate
991*0Sstevel@tonic-gate=item pmreplroot
992*0Sstevel@tonic-gate
993*0Sstevel@tonic-gate=item pmreplstart
994*0Sstevel@tonic-gate
995*0Sstevel@tonic-gate=item pmnext
996*0Sstevel@tonic-gate
997*0Sstevel@tonic-gate=item pmregexp
998*0Sstevel@tonic-gate
999*0Sstevel@tonic-gate=item pmflags
1000*0Sstevel@tonic-gate
1001*0Sstevel@tonic-gate=item pmdynflags
1002*0Sstevel@tonic-gate
1003*0Sstevel@tonic-gate=item pmpermflags
1004*0Sstevel@tonic-gate
1005*0Sstevel@tonic-gate=item precomp
1006*0Sstevel@tonic-gate
1007*0Sstevel@tonic-gate=item pmoffset
1008*0Sstevel@tonic-gate
1009*0Sstevel@tonic-gateOnly when perl was compiled with ithreads.
1010*0Sstevel@tonic-gate
1011*0Sstevel@tonic-gate=back
1012*0Sstevel@tonic-gate
1013*0Sstevel@tonic-gate=head2 B::SVOP METHOD
1014*0Sstevel@tonic-gate
1015*0Sstevel@tonic-gate=over 4
1016*0Sstevel@tonic-gate
1017*0Sstevel@tonic-gate=item sv
1018*0Sstevel@tonic-gate
1019*0Sstevel@tonic-gate=item gv
1020*0Sstevel@tonic-gate
1021*0Sstevel@tonic-gate=back
1022*0Sstevel@tonic-gate
1023*0Sstevel@tonic-gate=head2 B::PADOP METHOD
1024*0Sstevel@tonic-gate
1025*0Sstevel@tonic-gate=over 4
1026*0Sstevel@tonic-gate
1027*0Sstevel@tonic-gate=item padix
1028*0Sstevel@tonic-gate
1029*0Sstevel@tonic-gate=back
1030*0Sstevel@tonic-gate
1031*0Sstevel@tonic-gate=head2 B::PVOP METHOD
1032*0Sstevel@tonic-gate
1033*0Sstevel@tonic-gate=over 4
1034*0Sstevel@tonic-gate
1035*0Sstevel@tonic-gate=item pv
1036*0Sstevel@tonic-gate
1037*0Sstevel@tonic-gate=back
1038*0Sstevel@tonic-gate
1039*0Sstevel@tonic-gate=head2 B::LOOP Methods
1040*0Sstevel@tonic-gate
1041*0Sstevel@tonic-gate=over 4
1042*0Sstevel@tonic-gate
1043*0Sstevel@tonic-gate=item redoop
1044*0Sstevel@tonic-gate
1045*0Sstevel@tonic-gate=item nextop
1046*0Sstevel@tonic-gate
1047*0Sstevel@tonic-gate=item lastop
1048*0Sstevel@tonic-gate
1049*0Sstevel@tonic-gate=back
1050*0Sstevel@tonic-gate
1051*0Sstevel@tonic-gate=head2 B::COP Methods
1052*0Sstevel@tonic-gate
1053*0Sstevel@tonic-gate=over 4
1054*0Sstevel@tonic-gate
1055*0Sstevel@tonic-gate=item label
1056*0Sstevel@tonic-gate
1057*0Sstevel@tonic-gate=item stash
1058*0Sstevel@tonic-gate
1059*0Sstevel@tonic-gate=item stashpv
1060*0Sstevel@tonic-gate
1061*0Sstevel@tonic-gate=item file
1062*0Sstevel@tonic-gate
1063*0Sstevel@tonic-gate=item cop_seq
1064*0Sstevel@tonic-gate
1065*0Sstevel@tonic-gate=item arybase
1066*0Sstevel@tonic-gate
1067*0Sstevel@tonic-gate=item line
1068*0Sstevel@tonic-gate
1069*0Sstevel@tonic-gate=item warnings
1070*0Sstevel@tonic-gate
1071*0Sstevel@tonic-gate=item io
1072*0Sstevel@tonic-gate
1073*0Sstevel@tonic-gate=back
1074*0Sstevel@tonic-gate
1075*0Sstevel@tonic-gate
1076*0Sstevel@tonic-gate=head1 AUTHOR
1077*0Sstevel@tonic-gate
1078*0Sstevel@tonic-gateMalcolm Beattie, C<mbeattie@sable.ox.ac.uk>
1079*0Sstevel@tonic-gate
1080*0Sstevel@tonic-gate=cut
1081