1N/A# B.pm
1N/A#
1N/A# Copyright (c) 1996, 1997, 1998 Malcolm Beattie
1N/A#
1N/A# You may distribute under the terms of either the GNU General Public
1N/A# License or the Artistic License, as specified in the README file.
1N/A#
1N/Apackage B;
1N/A
1N/Aour $VERSION = '1.02';
1N/A
1N/Ause XSLoader ();
1N/Arequire Exporter;
1N/A@ISA = qw(Exporter);
1N/A
1N/A# walkoptree_slow comes from B.pm (you are there),
1N/A# walkoptree comes from B.xs
1N/A@EXPORT_OK = qw(minus_c ppname save_BEGINs
1N/A class peekop cast_I32 cstring cchar hash threadsv_names
1N/A main_root main_start main_cv svref_2object opnumber
1N/A amagic_generation perlstring
1N/A walkoptree_slow walkoptree walkoptree_exec walksymtable
1N/A parents comppadlist sv_undef compile_stats timing_info
1N/A begin_av init_av check_av end_av regex_padav dowarn
1N/A defstash curstash warnhook diehook inc_gv
1N/A );
1N/A
1N/Asub OPf_KIDS ();
1N/Ause strict;
1N/A@B::SV::ISA = 'B::OBJECT';
1N/A@B::NULL::ISA = 'B::SV';
1N/A@B::PV::ISA = 'B::SV';
1N/A@B::IV::ISA = 'B::SV';
1N/A@B::NV::ISA = 'B::IV';
1N/A@B::RV::ISA = 'B::SV';
1N/A@B::PVIV::ISA = qw(B::PV B::IV);
1N/A@B::PVNV::ISA = qw(B::PV B::NV);
1N/A@B::PVMG::ISA = 'B::PVNV';
1N/A@B::PVLV::ISA = 'B::PVMG';
1N/A@B::BM::ISA = 'B::PVMG';
1N/A@B::AV::ISA = 'B::PVMG';
1N/A@B::GV::ISA = 'B::PVMG';
1N/A@B::HV::ISA = 'B::PVMG';
1N/A@B::CV::ISA = 'B::PVMG';
1N/A@B::IO::ISA = 'B::PVMG';
1N/A@B::FM::ISA = 'B::CV';
1N/A
1N/A@B::OP::ISA = 'B::OBJECT';
1N/A@B::UNOP::ISA = 'B::OP';
1N/A@B::BINOP::ISA = 'B::UNOP';
1N/A@B::LOGOP::ISA = 'B::UNOP';
1N/A@B::LISTOP::ISA = 'B::BINOP';
1N/A@B::SVOP::ISA = 'B::OP';
1N/A@B::PADOP::ISA = 'B::OP';
1N/A@B::PVOP::ISA = 'B::OP';
1N/A@B::LOOP::ISA = 'B::LISTOP';
1N/A@B::PMOP::ISA = 'B::LISTOP';
1N/A@B::COP::ISA = 'B::OP';
1N/A
1N/A@B::SPECIAL::ISA = 'B::OBJECT';
1N/A
1N/A{
1N/A # Stop "-w" from complaining about the lack of a real B::OBJECT class
1N/A package B::OBJECT;
1N/A}
1N/A
1N/Asub B::GV::SAFENAME {
1N/A my $name = (shift())->NAME;
1N/A
1N/A # The regex below corresponds to the isCONTROLVAR macro
1N/A # from toke.c
1N/A
1N/A $name =~ s/^([\cA-\cZ\c\\c[\c]\c?\c_\c^])/"^".
1N/A chr( utf8::unicode_to_native( 64 ^ ord($1) ))/e;
1N/A
1N/A # When we say unicode_to_native we really mean ascii_to_native,
1N/A # which matters iff this is a non-ASCII platform (EBCDIC).
1N/A
1N/A return $name;
1N/A}
1N/A
1N/Asub B::IV::int_value {
1N/A my ($self) = @_;
1N/A return (($self->FLAGS() & SVf_IVisUV()) ? $self->UVX : $self->IV);
1N/A}
1N/A
1N/Asub B::NULL::as_string() {""}
1N/Asub B::IV::as_string() {goto &B::IV::int_value}
1N/Asub B::PV::as_string() {goto &B::PV::PV}
1N/A
1N/Amy $debug;
1N/Amy $op_count = 0;
1N/Amy @parents = ();
1N/A
1N/Asub debug {
1N/A my ($class, $value) = @_;
1N/A $debug = $value;
1N/A walkoptree_debug($value);
1N/A}
1N/A
1N/Asub class {
1N/A my $obj = shift;
1N/A my $name = ref $obj;
1N/A $name =~ s/^.*:://;
1N/A return $name;
1N/A}
1N/A
1N/Asub parents { \@parents }
1N/A
1N/A# For debugging
1N/Asub peekop {
1N/A my $op = shift;
1N/A return sprintf("%s (0x%x) %s", class($op), $$op, $op->name);
1N/A}
1N/A
1N/Asub walkoptree_slow {
1N/A my($op, $method, $level) = @_;
1N/A $op_count++; # just for statistics
1N/A $level ||= 0;
1N/A warn(sprintf("walkoptree: %d. %s\n", $level, peekop($op))) if $debug;
1N/A $op->$method($level);
1N/A if ($$op && ($op->flags & OPf_KIDS)) {
1N/A my $kid;
1N/A unshift(@parents, $op);
1N/A for ($kid = $op->first; $$kid; $kid = $kid->sibling) {
1N/A walkoptree_slow($kid, $method, $level + 1);
1N/A }
1N/A shift @parents;
1N/A }
1N/A if (class($op) eq 'PMOP' && $op->pmreplroot && ${$op->pmreplroot}) {
1N/A unshift(@parents, $op);
1N/A walkoptree_slow($op->pmreplroot, $method, $level + 1);
1N/A shift @parents;
1N/A }
1N/A}
1N/A
1N/Asub compile_stats {
1N/A return "Total number of OPs processed: $op_count\n";
1N/A}
1N/A
1N/Asub timing_info {
1N/A my ($sec, $min, $hr) = localtime;
1N/A my ($user, $sys) = times;
1N/A sprintf("%02d:%02d:%02d user=$user sys=$sys",
1N/A $hr, $min, $sec, $user, $sys);
1N/A}
1N/A
1N/Amy %symtable;
1N/A
1N/Asub clearsym {
1N/A %symtable = ();
1N/A}
1N/A
1N/Asub savesym {
1N/A my ($obj, $value) = @_;
1N/A# warn(sprintf("savesym: sym_%x => %s\n", $$obj, $value)); # debug
1N/A $symtable{sprintf("sym_%x", $$obj)} = $value;
1N/A}
1N/A
1N/Asub objsym {
1N/A my $obj = shift;
1N/A return $symtable{sprintf("sym_%x", $$obj)};
1N/A}
1N/A
1N/Asub walkoptree_exec {
1N/A my ($op, $method, $level) = @_;
1N/A $level ||= 0;
1N/A my ($sym, $ppname);
1N/A my $prefix = " " x $level;
1N/A for (; $$op; $op = $op->next) {
1N/A $sym = objsym($op);
1N/A if (defined($sym)) {
1N/A print $prefix, "goto $sym\n";
1N/A return;
1N/A }
1N/A savesym($op, sprintf("%s (0x%lx)", class($op), $$op));
1N/A $op->$method($level);
1N/A $ppname = $op->name;
1N/A if ($ppname =~
1N/A /^(or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/)
1N/A {
1N/A print $prefix, uc($1), " => {\n";
1N/A walkoptree_exec($op->other, $method, $level + 1);
1N/A print $prefix, "}\n";
1N/A } elsif ($ppname eq "match" || $ppname eq "subst") {
1N/A my $pmreplstart = $op->pmreplstart;
1N/A if ($$pmreplstart) {
1N/A print $prefix, "PMREPLSTART => {\n";
1N/A walkoptree_exec($pmreplstart, $method, $level + 1);
1N/A print $prefix, "}\n";
1N/A }
1N/A } elsif ($ppname eq "substcont") {
1N/A print $prefix, "SUBSTCONT => {\n";
1N/A walkoptree_exec($op->other->pmreplstart, $method, $level + 1);
1N/A print $prefix, "}\n";
1N/A $op = $op->other;
1N/A } elsif ($ppname eq "enterloop") {
1N/A print $prefix, "REDO => {\n";
1N/A walkoptree_exec($op->redoop, $method, $level + 1);
1N/A print $prefix, "}\n", $prefix, "NEXT => {\n";
1N/A walkoptree_exec($op->nextop, $method, $level + 1);
1N/A print $prefix, "}\n", $prefix, "LAST => {\n";
1N/A walkoptree_exec($op->lastop, $method, $level + 1);
1N/A print $prefix, "}\n";
1N/A } elsif ($ppname eq "subst") {
1N/A my $replstart = $op->pmreplstart;
1N/A if ($$replstart) {
1N/A print $prefix, "SUBST => {\n";
1N/A walkoptree_exec($replstart, $method, $level + 1);
1N/A print $prefix, "}\n";
1N/A }
1N/A }
1N/A }
1N/A}
1N/A
1N/Asub walksymtable {
1N/A my ($symref, $method, $recurse, $prefix) = @_;
1N/A my $sym;
1N/A my $ref;
1N/A my $fullname;
1N/A no strict 'refs';
1N/A $prefix = '' unless defined $prefix;
1N/A while (($sym, $ref) = each %$symref) {
1N/A $fullname = "*main::".$prefix.$sym;
1N/A if ($sym =~ /::$/) {
1N/A $sym = $prefix . $sym;
1N/A if ($sym ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
1N/A walksymtable(\%$fullname, $method, $recurse, $sym);
1N/A }
1N/A } else {
1N/A svref_2object(\*$fullname)->$method();
1N/A }
1N/A }
1N/A}
1N/A
1N/A{
1N/A package B::Section;
1N/A my $output_fh;
1N/A my %sections;
1N/A
1N/A sub new {
1N/A my ($class, $section, $symtable, $default) = @_;
1N/A $output_fh ||= FileHandle->new_tmpfile;
1N/A my $obj = bless [-1, $section, $symtable, $default], $class;
1N/A $sections{$section} = $obj;
1N/A return $obj;
1N/A }
1N/A
1N/A sub get {
1N/A my ($class, $section) = @_;
1N/A return $sections{$section};
1N/A }
1N/A
1N/A sub add {
1N/A my $section = shift;
1N/A while (defined($_ = shift)) {
1N/A print $output_fh "$section->[1]\t$_\n";
1N/A $section->[0]++;
1N/A }
1N/A }
1N/A
1N/A sub index {
1N/A my $section = shift;
1N/A return $section->[0];
1N/A }
1N/A
1N/A sub name {
1N/A my $section = shift;
1N/A return $section->[1];
1N/A }
1N/A
1N/A sub symtable {
1N/A my $section = shift;
1N/A return $section->[2];
1N/A }
1N/A
1N/A sub default {
1N/A my $section = shift;
1N/A return $section->[3];
1N/A }
1N/A
1N/A sub output {
1N/A my ($section, $fh, $format) = @_;
1N/A my $name = $section->name;
1N/A my $sym = $section->symtable || {};
1N/A my $default = $section->default;
1N/A
1N/A seek($output_fh, 0, 0);
1N/A while (<$output_fh>) {
1N/A chomp;
1N/A s/^(.*?)\t//;
1N/A if ($1 eq $name) {
1N/A s{(s\\_[0-9a-f]+)} {
1N/A exists($sym->{$1}) ? $sym->{$1} : $default;
1N/A }ge;
1N/A printf $fh $format, $_;
1N/A }
1N/A }
1N/A }
1N/A}
1N/A
1N/AXSLoader::load 'B';
1N/A
1N/A1;
1N/A
1N/A__END__
1N/A
1N/A=head1 NAME
1N/A
1N/AB - The Perl Compiler
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use B;
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThe C<B> module supplies classes which allow a Perl program to delve
1N/Ainto its own innards. It is the module used to implement the
1N/A"backends" of the Perl compiler. Usage of the compiler does not
1N/Arequire knowledge of this module: see the F<O> module for the
1N/Auser-visible part. The C<B> module is of use to those who want to
1N/Awrite new compiler backends. This documentation assumes that the
1N/Areader knows a fair amount about perl's internals including such
1N/Athings as SVs, OPs and the internal symbol table and syntax tree
1N/Aof a program.
1N/A
1N/A=head1 OVERVIEW
1N/A
1N/AThe C<B> module contains a set of utility functions for querying the
1N/Acurrent state of the Perl interpreter; typically these functions
1N/Areturn objects from the B::SV and B::OP classes, or their derived
1N/Aclasses. These classes in turn define methods for querying the
1N/Aresulting objects about their own internal state.
1N/A
1N/A=head1 Utility Functions
1N/A
1N/AThe C<B> module exports a variety of functions: some are simple
1N/Autility functions, others provide a Perl program with a way to
1N/Aget an initial "handle" on an internal object.
1N/A
1N/A=head2 Functions Returning C<B::SV>, C<B::AV>, C<B::HV>, and C<B::CV> objects
1N/A
1N/AFor descriptions of the class hierachy of these objects and the
1N/Amethods that can be called on them, see below, L<"OVERVIEW OF
1N/ACLASSES"> and L<"SV-RELATED CLASSES">.
1N/A
1N/A=over 4
1N/A
1N/A=item sv_undef
1N/A
1N/AReturns the SV object corresponding to the C variable C<sv_undef>.
1N/A
1N/A=item sv_yes
1N/A
1N/AReturns the SV object corresponding to the C variable C<sv_yes>.
1N/A
1N/A=item sv_no
1N/A
1N/AReturns the SV object corresponding to the C variable C<sv_no>.
1N/A
1N/A=item svref_2object(SVREF)
1N/A
1N/ATakes a reference to any Perl value, and turns the referred-to value
1N/Ainto an object in the appropriate B::OP-derived or B::SV-derived
1N/Aclass. Apart from functions such as C<main_root>, this is the primary
1N/Away to get an initial "handle" on an internal perl data structure
1N/Awhich can then be followed with the other access methods.
1N/A
1N/A=item amagic_generation
1N/A
1N/AReturns the SV object corresponding to the C variable C<amagic_generation>.
1N/A
1N/A=item init_av
1N/A
1N/AReturns the AV object (i.e. in class B::AV) representing INIT blocks.
1N/A
1N/A=item check_av
1N/A
1N/AReturns the AV object (i.e. in class B::AV) representing CHECK blocks.
1N/A
1N/A=item begin_av
1N/A
1N/AReturns the AV object (i.e. in class B::AV) representing BEGIN blocks.
1N/A
1N/A=item end_av
1N/A
1N/AReturns the AV object (i.e. in class B::AV) representing END blocks.
1N/A
1N/A=item comppadlist
1N/A
1N/AReturns the AV object (i.e. in class B::AV) of the global comppadlist.
1N/A
1N/A=item regex_padav
1N/A
1N/AOnly when perl was compiled with ithreads.
1N/A
1N/A=item main_cv
1N/A
1N/AReturn the (faked) CV corresponding to the main part of the Perl
1N/Aprogram.
1N/A
1N/A=back
1N/A
1N/A=head2 Functions for Examining the Symbol Table
1N/A
1N/A=over 4
1N/A
1N/A=item walksymtable(SYMREF, METHOD, RECURSE, PREFIX)
1N/A
1N/AWalk the symbol table starting at SYMREF and call METHOD on each
1N/Asymbol (a B::GV object) visited. When the walk reaches package
1N/Asymbols (such as "Foo::") it invokes RECURSE, passing in the symbol
1N/Aname, and only recurses into the package if that sub returns true.
1N/A
1N/APREFIX is the name of the SYMREF you're walking.
1N/A
1N/AFor example:
1N/A
1N/A # Walk CGI's symbol table calling print_subs on each symbol.
1N/A # Recurse only into CGI::Util::
1N/A walksymtable(\%CGI::, 'print_subs', sub { $_[0] eq 'CGI::Util::' },
1N/A 'CGI::');
1N/A
1N/Aprint_subs() is a B::GV method you have declared. Also see L<"B::GV
1N/AMethods">, below.
1N/A
1N/A=back
1N/A
1N/A=head2 Functions Returning C<B::OP> objects or for walking op trees
1N/A
1N/AFor descriptions of the class hierachy of these objects and the
1N/Amethods that can be called on them, see below, L<"OVERVIEW OF
1N/ACLASSES"> and L<"OP-RELATED CLASSES">.
1N/A
1N/A=over 4
1N/A
1N/A=item main_root
1N/A
1N/AReturns the root op (i.e. an object in the appropriate B::OP-derived
1N/Aclass) of the main part of the Perl program.
1N/A
1N/A=item main_start
1N/A
1N/AReturns the starting op of the main part of the Perl program.
1N/A
1N/A=item walkoptree(OP, METHOD)
1N/A
1N/ADoes a tree-walk of the syntax tree based at OP and calls METHOD on
1N/Aeach op it visits. Each node is visited before its children. If
1N/AC<walkoptree_debug> (see below) has been called to turn debugging on then
1N/Athe method C<walkoptree_debug> is called on each op before METHOD is
1N/Acalled.
1N/A
1N/A=item walkoptree_debug(DEBUG)
1N/A
1N/AReturns the current debugging flag for C<walkoptree>. If the optional
1N/ADEBUG argument is non-zero, it sets the debugging flag to that. See
1N/Athe description of C<walkoptree> above for what the debugging flag
1N/Adoes.
1N/A
1N/A=back
1N/A
1N/A=head2 Miscellaneous Utility Functions
1N/A
1N/A=over 4
1N/A
1N/A=item ppname(OPNUM)
1N/A
1N/AReturn the PP function name (e.g. "pp_add") of op number OPNUM.
1N/A
1N/A=item hash(STR)
1N/A
1N/AReturns a string in the form "0x..." representing the value of the
1N/Ainternal hash function used by perl on string STR.
1N/A
1N/A=item cast_I32(I)
1N/A
1N/ACasts I to the internal I32 type used by that perl.
1N/A
1N/A=item minus_c
1N/A
1N/ADoes the equivalent of the C<-c> command-line option. Obviously, this
1N/Ais only useful in a BEGIN block or else the flag is set too late.
1N/A
1N/A=item cstring(STR)
1N/A
1N/AReturns a double-quote-surrounded escaped version of STR which can
1N/Abe used as a string in C source code.
1N/A
1N/A=item perlstring(STR)
1N/A
1N/AReturns a double-quote-surrounded escaped version of STR which can
1N/Abe used as a string in Perl source code.
1N/A
1N/A=item class(OBJ)
1N/A
1N/AReturns the class of an object without the part of the classname
1N/Apreceding the first C<"::">. This is used to turn C<"B::UNOP"> into
1N/AC<"UNOP"> for example.
1N/A
1N/A=item threadsv_names
1N/A
1N/AIn a perl compiled for threads, this returns a list of the special
1N/Aper-thread threadsv variables.
1N/A
1N/A=back
1N/A
1N/A
1N/A
1N/A
1N/A=head1 OVERVIEW OF CLASSES
1N/A
1N/AThe C structures used by Perl's internals to hold SV and OP
1N/Ainformation (PVIV, AV, HV, ..., OP, SVOP, UNOP, ...) are modelled on a
1N/Aclass hierarchy and the C<B> module gives access to them via a true
1N/Aobject hierarchy. Structure fields which point to other objects
1N/A(whether types of SV or types of OP) are represented by the C<B>
1N/Amodule as Perl objects of the appropriate class.
1N/A
1N/AThe bulk of the C<B> module is the methods for accessing fields of
1N/Athese structures.
1N/A
1N/ANote that all access is read-only. You cannot modify the internals by
1N/Ausing this module.
1N/A
1N/A=head2 SV-RELATED CLASSES
1N/A
1N/AB::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV,
1N/AB::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in
1N/Athe obvious way to the underlying C structures of similar names. The
1N/Ainheritance hierarchy mimics the underlying C "inheritance":
1N/A
1N/A B::SV
1N/A |
1N/A +--------------+----------------------+
1N/A | | |
1N/A B::PV B::IV B::RV
1N/A | \ / \
1N/A | \ / \
1N/A | B::PVIV B::NV
1N/A \ /
1N/A \____ __/
1N/A \ /
1N/A B::PVNV
1N/A |
1N/A |
1N/A B::PVMG
1N/A |
1N/A +------+-----+----+------+-----+-----+
1N/A | | | | | | |
1N/A B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO
1N/A |
1N/A |
1N/A B::FM
1N/A
1N/A
1N/AAccess methods correspond to the underlying C macros for field access,
1N/Ausually with the leading "class indication" prefix removed (Sv, Av,
1N/AHv, ...). The leading prefix is only left in cases where its removal
1N/Awould cause a clash in method name. For example, C<GvREFCNT> stays
1N/Aas-is since its abbreviation would clash with the "superclass" method
1N/AC<REFCNT> (corresponding to the C function C<SvREFCNT>).
1N/A
1N/A=head2 B::SV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item REFCNT
1N/A
1N/A=item FLAGS
1N/A
1N/A=item object_2svref
1N/A
1N/AReturns a reference to the regular scalar corresponding to this
1N/AB::SV object. In other words, this method is the inverse operation
1N/Ato the svref_2object() subroutine. This scalar and other data it points
1N/Aat should be considered read-only: modifying them is neither safe nor
1N/Aguaranteed to have a sensible effect.
1N/A
1N/A=back
1N/A
1N/A=head2 B::IV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item IV
1N/A
1N/AReturns the value of the IV, I<interpreted as
1N/Aa signed integer>. This will be misleading
1N/Aif C<FLAGS & SVf_IVisUV>. Perhaps you want the
1N/AC<int_value> method instead?
1N/A
1N/A=item IVX
1N/A
1N/A=item UVX
1N/A
1N/A=item int_value
1N/A
1N/AThis method returns the value of the IV as an integer.
1N/AIt differs from C<IV> in that it returns the correct
1N/Avalue regardless of whether it's stored signed or
1N/Aunsigned.
1N/A
1N/A=item needs64bits
1N/A
1N/A=item packiv
1N/A
1N/A=back
1N/A
1N/A=head2 B::NV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item NV
1N/A
1N/A=item NVX
1N/A
1N/A=back
1N/A
1N/A=head2 B::RV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item RV
1N/A
1N/A=back
1N/A
1N/A=head2 B::PV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item PV
1N/A
1N/AThis method is the one you usually want. It constructs a
1N/Astring using the length and offset information in the struct:
1N/Afor ordinary scalars it will return the string that you'd see
1N/Afrom Perl, even if it contains null characters.
1N/A
1N/A=item RV
1N/A
1N/ASame as B::RV::RV, except that it will die() if the PV isn't
1N/Aa reference.
1N/A
1N/A=item PVX
1N/A
1N/AThis method is less often useful. It assumes that the string
1N/Astored in the struct is null-terminated, and disregards the
1N/Alength information.
1N/A
1N/AIt is the appropriate method to use if you need to get the name
1N/Aof a lexical variable from a padname array. Lexical variable names
1N/Aare always stored with a null terminator, and the length field
1N/A(SvCUR) is overloaded for other purposes and can't be relied on here.
1N/A
1N/A=back
1N/A
1N/A=head2 B::PVMG Methods
1N/A
1N/A=over 4
1N/A
1N/A=item MAGIC
1N/A
1N/A=item SvSTASH
1N/A
1N/A=back
1N/A
1N/A=head2 B::MAGIC Methods
1N/A
1N/A=over 4
1N/A
1N/A=item MOREMAGIC
1N/A
1N/A=item precomp
1N/A
1N/AOnly valid on r-magic, returns the string that generated the regexp.
1N/A
1N/A=item PRIVATE
1N/A
1N/A=item TYPE
1N/A
1N/A=item FLAGS
1N/A
1N/A=item OBJ
1N/A
1N/AWill die() if called on r-magic.
1N/A
1N/A=item PTR
1N/A
1N/A=item REGEX
1N/A
1N/AOnly valid on r-magic, returns the integer value of the REGEX stored
1N/Ain the MAGIC.
1N/A
1N/A=back
1N/A
1N/A=head2 B::PVLV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item TARGOFF
1N/A
1N/A=item TARGLEN
1N/A
1N/A=item TYPE
1N/A
1N/A=item TARG
1N/A
1N/A=back
1N/A
1N/A=head2 B::BM Methods
1N/A
1N/A=over 4
1N/A
1N/A=item USEFUL
1N/A
1N/A=item PREVIOUS
1N/A
1N/A=item RARE
1N/A
1N/A=item TABLE
1N/A
1N/A=back
1N/A
1N/A=head2 B::GV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item is_empty
1N/A
1N/AThis method returns TRUE if the GP field of the GV is NULL.
1N/A
1N/A=item NAME
1N/A
1N/A=item SAFENAME
1N/A
1N/AThis method returns the name of the glob, but if the first
1N/Acharacter of the name is a control character, then it converts
1N/Ait to ^X first, so that *^G would return "^G" rather than "\cG".
1N/A
1N/AIt's useful if you want to print out the name of a variable.
1N/AIf you restrict yourself to globs which exist at compile-time
1N/Athen the result ought to be unambiguous, because code like
1N/AC<${"^G"} = 1> is compiled as two ops - a constant string and
1N/Aa dereference (rv2gv) - so that the glob is created at runtime.
1N/A
1N/AIf you're working with globs at runtime, and need to disambiguate
1N/A*^G from *{"^G"}, then you should use the raw NAME method.
1N/A
1N/A=item STASH
1N/A
1N/A=item SV
1N/A
1N/A=item IO
1N/A
1N/A=item FORM
1N/A
1N/A=item AV
1N/A
1N/A=item HV
1N/A
1N/A=item EGV
1N/A
1N/A=item CV
1N/A
1N/A=item CVGEN
1N/A
1N/A=item LINE
1N/A
1N/A=item FILE
1N/A
1N/A=item FILEGV
1N/A
1N/A=item GvREFCNT
1N/A
1N/A=item FLAGS
1N/A
1N/A=back
1N/A
1N/A=head2 B::IO Methods
1N/A
1N/A=over 4
1N/A
1N/A=item LINES
1N/A
1N/A=item PAGE
1N/A
1N/A=item PAGE_LEN
1N/A
1N/A=item LINES_LEFT
1N/A
1N/A=item TOP_NAME
1N/A
1N/A=item TOP_GV
1N/A
1N/A=item FMT_NAME
1N/A
1N/A=item FMT_GV
1N/A
1N/A=item BOTTOM_NAME
1N/A
1N/A=item BOTTOM_GV
1N/A
1N/A=item SUBPROCESS
1N/A
1N/A=item IoTYPE
1N/A
1N/A=item IoFLAGS
1N/A
1N/A=item IsSTD
1N/A
1N/ATakes one arguments ( 'stdin' | 'stdout' | 'stderr' ) and returns true
1N/Aif the IoIFP of the object is equal to the handle whose name was
1N/Apassed as argument ( i.e. $io->IsSTD('stderr') is true if
1N/AIoIFP($io) == PerlIO_stdin() ).
1N/A
1N/A=back
1N/A
1N/A=head2 B::AV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item FILL
1N/A
1N/A=item MAX
1N/A
1N/A=item OFF
1N/A
1N/A=item ARRAY
1N/A
1N/A=item ARRAYelt
1N/A
1N/ALike C<ARRAY>, but takes an index as an argument to get only one element,
1N/Arather than a list of all of them.
1N/A
1N/A=item AvFLAGS
1N/A
1N/A=back
1N/A
1N/A=head2 B::CV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item STASH
1N/A
1N/A=item START
1N/A
1N/A=item ROOT
1N/A
1N/A=item GV
1N/A
1N/A=item FILE
1N/A
1N/A=item DEPTH
1N/A
1N/A=item PADLIST
1N/A
1N/A=item OUTSIDE
1N/A
1N/A=item OUTSIDE_SEQ
1N/A
1N/A=item XSUB
1N/A
1N/A=item XSUBANY
1N/A
1N/AFor constant subroutines, returns the constant SV returned by the subroutine.
1N/A
1N/A=item CvFLAGS
1N/A
1N/A=item const_sv
1N/A
1N/A=back
1N/A
1N/A=head2 B::HV Methods
1N/A
1N/A=over 4
1N/A
1N/A=item FILL
1N/A
1N/A=item MAX
1N/A
1N/A=item KEYS
1N/A
1N/A=item RITER
1N/A
1N/A=item NAME
1N/A
1N/A=item PMROOT
1N/A
1N/A=item ARRAY
1N/A
1N/A=back
1N/A
1N/A=head2 OP-RELATED CLASSES
1N/A
1N/AC<B::OP>, C<B::UNOP>, C<B::BINOP>, C<B::LOGOP>, C<B::LISTOP>, C<B::PMOP>,
1N/AC<B::SVOP>, C<B::PADOP>, C<B::PVOP>, C<B::LOOP>, C<B::COP>.
1N/A
1N/AThese classes correspond in the obvious way to the underlying C
1N/Astructures of similar names. The inheritance hierarchy mimics the
1N/Aunderlying C "inheritance":
1N/A
1N/A B::OP
1N/A |
1N/A +---------------+--------+--------+
1N/A | | | |
1N/A B::UNOP B::SVOP B::PADOP B::COP
1N/A ,' `-.
1N/A / `--.
1N/A B::BINOP B::LOGOP
1N/A |
1N/A |
1N/A B::LISTOP
1N/A ,' `.
1N/A / \
1N/A B::LOOP B::PMOP
1N/A
1N/AAccess methods correspond to the underlying C structre field names,
1N/Awith the leading "class indication" prefix (C<"op_">) removed.
1N/A
1N/A=head2 B::OP Methods
1N/A
1N/A=over 4
1N/A
1N/A=item next
1N/A
1N/A=item sibling
1N/A
1N/A=item name
1N/A
1N/AThis returns the op name as a string (e.g. "add", "rv2av").
1N/A
1N/A=item ppaddr
1N/A
1N/AThis returns the function name as a string (e.g. "PL_ppaddr[OP_ADD]",
1N/A"PL_ppaddr[OP_RV2AV]").
1N/A
1N/A=item desc
1N/A
1N/AThis returns the op description from the global C PL_op_desc array
1N/A(e.g. "addition" "array deref").
1N/A
1N/A=item targ
1N/A
1N/A=item type
1N/A
1N/A=item seq
1N/A
1N/A=item flags
1N/A
1N/A=item private
1N/A
1N/A=back
1N/A
1N/A=head2 B::UNOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item first
1N/A
1N/A=back
1N/A
1N/A=head2 B::BINOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item last
1N/A
1N/A=back
1N/A
1N/A=head2 B::LOGOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item other
1N/A
1N/A=back
1N/A
1N/A=head2 B::LISTOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item children
1N/A
1N/A=back
1N/A
1N/A=head2 B::PMOP Methods
1N/A
1N/A=over 4
1N/A
1N/A=item pmreplroot
1N/A
1N/A=item pmreplstart
1N/A
1N/A=item pmnext
1N/A
1N/A=item pmregexp
1N/A
1N/A=item pmflags
1N/A
1N/A=item pmdynflags
1N/A
1N/A=item pmpermflags
1N/A
1N/A=item precomp
1N/A
1N/A=item pmoffset
1N/A
1N/AOnly when perl was compiled with ithreads.
1N/A
1N/A=back
1N/A
1N/A=head2 B::SVOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item sv
1N/A
1N/A=item gv
1N/A
1N/A=back
1N/A
1N/A=head2 B::PADOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item padix
1N/A
1N/A=back
1N/A
1N/A=head2 B::PVOP METHOD
1N/A
1N/A=over 4
1N/A
1N/A=item pv
1N/A
1N/A=back
1N/A
1N/A=head2 B::LOOP Methods
1N/A
1N/A=over 4
1N/A
1N/A=item redoop
1N/A
1N/A=item nextop
1N/A
1N/A=item lastop
1N/A
1N/A=back
1N/A
1N/A=head2 B::COP Methods
1N/A
1N/A=over 4
1N/A
1N/A=item label
1N/A
1N/A=item stash
1N/A
1N/A=item stashpv
1N/A
1N/A=item file
1N/A
1N/A=item cop_seq
1N/A
1N/A=item arybase
1N/A
1N/A=item line
1N/A
1N/A=item warnings
1N/A
1N/A=item io
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 AUTHOR
1N/A
1N/AMalcolm Beattie, C<mbeattie@sable.ox.ac.uk>
1N/A
1N/A=cut