3 # Copyright (c) 1996, 1997, 1998 Malcolm Beattie
5 # You may distribute under the terms of either the GNU General Public
6 # License or the Artistic License, as specified in the README file.
12 @B::ISA = qw(Exporter);
14 # walkoptree_slow comes from B.pm (you are there),
15 # walkoptree comes from B.xs
21 # Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
22 # Want our constants loaded before the compiler meets OPf_KIDS below, as
23 # the combination of having the constant stay a Proxy Constant Subroutine
24 # and its value being inlined saves a little over .5K
30 push @B::EXPORT_OK, (qw(minus_c ppname save_BEGINs
31 class peekop cast_I32 cstring cchar hash threadsv_names
32 main_root main_start main_cv svref_2object opnumber
33 sub_generation amagic_generation perlstring
34 walkoptree_slow walkoptree walkoptree_exec walksymtable
35 parents comppadlist sv_undef compile_stats timing_info
36 begin_av init_av check_av end_av regex_padav dowarn
37 defstash curstash warnhook diehook inc_gv @optype
38 @specialsv_name unitcheck_av safename));
40 @B::SV::ISA = 'B::OBJECT';
41 @B::NULL::ISA = 'B::SV';
42 @B::PV::ISA = 'B::SV';
43 @B::IV::ISA = 'B::SV';
44 @B::NV::ISA = 'B::SV';
45 # RV is eliminated with 5.11.0, but effectively is a specialisation of IV now.
46 @B::RV::ISA = $] >= 5.011 ? 'B::IV' : 'B::SV';
47 @B::PVIV::ISA = qw(B::PV B::IV);
48 @B::PVNV::ISA = qw(B::PVIV B::NV);
49 @B::PVMG::ISA = 'B::PVNV';
50 @B::REGEXP::ISA = 'B::PVMG' if $] >= 5.011;
51 @B::INVLIST::ISA = 'B::PV' if $] >= 5.019;
52 @B::PVLV::ISA = 'B::GV';
53 @B::BM::ISA = 'B::GV';
54 @B::AV::ISA = 'B::PVMG';
55 @B::GV::ISA = 'B::PVMG';
56 @B::HV::ISA = 'B::PVMG';
57 @B::CV::ISA = 'B::PVMG';
58 @B::IO::ISA = 'B::PVMG';
59 @B::FM::ISA = 'B::CV';
61 @B::OP::ISA = 'B::OBJECT';
62 @B::UNOP::ISA = 'B::OP';
63 @B::UNOP_AUX::ISA = 'B::UNOP';
64 @B::BINOP::ISA = 'B::UNOP';
65 @B::LOGOP::ISA = 'B::UNOP';
66 @B::LISTOP::ISA = 'B::BINOP';
67 @B::SVOP::ISA = 'B::OP';
68 @B::PADOP::ISA = 'B::OP';
69 @B::PVOP::ISA = 'B::OP';
70 @B::LOOP::ISA = 'B::LISTOP';
71 @B::PMOP::ISA = 'B::LISTOP';
72 @B::COP::ISA = 'B::OP';
73 @B::METHOP::ISA = 'B::OP';
75 @B::SPECIAL::ISA = 'B::OBJECT';
77 @B::optype = qw(OP UNOP BINOP LOGOP LISTOP PMOP SVOP PADOP PVOP LOOP COP
79 # bytecode.pl contained the following comment:
80 # Nullsv *must* come first in the following so that the condition
81 # ($$sv == 0) can continue to be used to test (sv == Nullsv).
82 @B::specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no
83 (SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD);
86 # Stop "-w" from complaining about the lack of a real B::OBJECT class
91 safename(shift()->NAME);
97 # The regex below corresponds to the isCONTROLVAR macro
101 or $name =~ s/^([\cA-\cZ\c\\c[\c]\c_\c^])/
102 "^" . chr( utf8::unicode_to_native( 64 ^ ord($1) ))/e;
104 # When we say unicode_to_native we really mean ascii_to_native,
105 # which matters iff this is a non-ASCII platform (EBCDIC). '\c?' would
106 # not have to be special cased, except for non-ASCII.
111 sub B::IV::int_value {
113 return (($self->FLAGS() & SVf_IVisUV()) ? $self->UVX : $self->IV);
116 sub B::NULL::as_string() {""}
117 *B::IV::as_string = \*B::IV::int_value;
118 *B::PV::as_string = \*B::PV::PV;
120 # The input typemap checking makes no distinction between different SV types,
121 # so the XS body will generate the same C code, despite the different XS
122 # "types". So there is no change in behaviour from doing "newXS" like this,
123 # compared with the old approach of having a (near) duplicate XS body.
124 # We should fix the typemap checking.
125 *B::IV::RV = \*B::PV::RV if $] > 5.012;
132 my ($class, $value) = @_;
134 walkoptree_debug($value);
144 sub parents { \@parents }
149 return sprintf("%s (0x%x) %s", class($op), $$op, $op->name);
152 sub walkoptree_slow {
153 my($op, $method, $level) = @_;
154 $op_count++; # just for statistics
156 warn(sprintf("walkoptree: %d. %s\n", $level, peekop($op))) if $debug;
157 $op->$method($level) if $op->can($method);
158 if ($$op && ($op->flags & OPf_KIDS)) {
160 unshift(@parents, $op);
161 for ($kid = $op->first; $$kid; $kid = $kid->sibling) {
162 walkoptree_slow($kid, $method, $level + 1);
166 if (class($op) eq 'PMOP'
167 && ref($op->pmreplroot)
168 && ${$op->pmreplroot}
169 && $op->pmreplroot->isa( 'B::OP' ))
171 unshift(@parents, $op);
172 walkoptree_slow($op->pmreplroot, $method, $level + 1);
178 return "Total number of OPs processed: $op_count\n";
182 my ($sec, $min, $hr) = localtime;
183 my ($user, $sys) = times;
184 sprintf("%02d:%02d:%02d user=$user sys=$sys",
185 $hr, $min, $sec, $user, $sys);
195 my ($obj, $value) = @_;
196 # warn(sprintf("savesym: sym_%x => %s\n", $$obj, $value)); # debug
197 $symtable{sprintf("sym_%x", $$obj)} = $value;
202 return $symtable{sprintf("sym_%x", $$obj)};
205 sub walkoptree_exec {
206 my ($op, $method, $level) = @_;
209 my $prefix = " " x $level;
210 for (; $$op; $op = $op->next) {
213 print $prefix, "goto $sym\n";
216 savesym($op, sprintf("%s (0x%lx)", class($op), $$op));
217 $op->$method($level);
220 /^(d?or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/)
222 print $prefix, uc($1), " => {\n";
223 walkoptree_exec($op->other, $method, $level + 1);
224 print $prefix, "}\n";
225 } elsif ($ppname eq "match" || $ppname eq "subst") {
226 my $pmreplstart = $op->pmreplstart;
228 print $prefix, "PMREPLSTART => {\n";
229 walkoptree_exec($pmreplstart, $method, $level + 1);
230 print $prefix, "}\n";
232 } elsif ($ppname eq "substcont") {
233 print $prefix, "SUBSTCONT => {\n";
234 walkoptree_exec($op->other->pmreplstart, $method, $level + 1);
235 print $prefix, "}\n";
237 } elsif ($ppname eq "enterloop") {
238 print $prefix, "REDO => {\n";
239 walkoptree_exec($op->redoop, $method, $level + 1);
240 print $prefix, "}\n", $prefix, "NEXT => {\n";
241 walkoptree_exec($op->nextop, $method, $level + 1);
242 print $prefix, "}\n", $prefix, "LAST => {\n";
243 walkoptree_exec($op->lastop, $method, $level + 1);
244 print $prefix, "}\n";
245 } elsif ($ppname eq "subst") {
246 my $replstart = $op->pmreplstart;
248 print $prefix, "SUBST => {\n";
249 walkoptree_exec($replstart, $method, $level + 1);
250 print $prefix, "}\n";
257 my ($symref, $method, $recurse, $prefix) = @_;
262 $prefix = '' unless defined $prefix;
263 foreach my $sym ( sort keys %$symref ) {
264 $ref= $symref->{$sym};
265 $fullname = "*main::".$prefix.$sym;
267 $sym = $prefix . $sym;
268 if (svref_2object(\*$sym)->NAME ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
269 walksymtable(\%$fullname, $method, $recurse, $sym);
272 svref_2object(\*$fullname)->$method();
283 B - The Perl Compiler Backend
291 The C<B> module supplies classes which allow a Perl program to delve
292 into its own innards. It is the module used to implement the
293 "backends" of the Perl compiler. Usage of the compiler does not
294 require knowledge of this module: see the F<O> module for the
295 user-visible part. The C<B> module is of use to those who want to
296 write new compiler backends. This documentation assumes that the
297 reader knows a fair amount about perl's internals including such
298 things as SVs, OPs and the internal symbol table and syntax tree
303 The C<B> module contains a set of utility functions for querying the
304 current state of the Perl interpreter; typically these functions
305 return objects from the B::SV and B::OP classes, or their derived
306 classes. These classes in turn define methods for querying the
307 resulting objects about their own internal state.
309 =head1 Utility Functions
311 The C<B> module exports a variety of functions: some are simple
312 utility functions, others provide a Perl program with a way to
313 get an initial "handle" on an internal object.
315 =head2 Functions Returning C<B::SV>, C<B::AV>, C<B::HV>, and C<B::CV> objects
317 For descriptions of the class hierarchy of these objects and the
318 methods that can be called on them, see below, L<"OVERVIEW OF
319 CLASSES"> and L<"SV-RELATED CLASSES">.
325 Returns the SV object corresponding to the C variable C<sv_undef>.
329 Returns the SV object corresponding to the C variable C<sv_yes>.
333 Returns the SV object corresponding to the C variable C<sv_no>.
335 =item svref_2object(SVREF)
337 Takes a reference to any Perl value, and turns the referred-to value
338 into an object in the appropriate B::OP-derived or B::SV-derived
339 class. Apart from functions such as C<main_root>, this is the primary
340 way to get an initial "handle" on an internal perl data structure
341 which can then be followed with the other access methods.
343 The returned object will only be valid as long as the underlying OPs
344 and SVs continue to exist. Do not attempt to use the object after the
345 underlying structures are freed.
347 =item amagic_generation
349 Returns the SV object corresponding to the C variable C<amagic_generation>.
350 As of Perl 5.18, this is just an alias to C<PL_na>, so its value is
355 Returns the AV object (i.e. in class B::AV) representing INIT blocks.
359 Returns the AV object (i.e. in class B::AV) representing CHECK blocks.
363 Returns the AV object (i.e. in class B::AV) representing UNITCHECK blocks.
367 Returns the AV object (i.e. in class B::AV) representing BEGIN blocks.
371 Returns the AV object (i.e. in class B::AV) representing END blocks.
375 Returns the PADLIST object (i.e. in class B::PADLIST) of the global
376 comppadlist. In Perl 5.16 and earlier it returns an AV object (class
381 Only when perl was compiled with ithreads.
385 Return the (faked) CV corresponding to the main part of the Perl
390 =head2 Functions for Examining the Symbol Table
394 =item walksymtable(SYMREF, METHOD, RECURSE, PREFIX)
396 Walk the symbol table starting at SYMREF and call METHOD on each
397 symbol (a B::GV object) visited. When the walk reaches package
398 symbols (such as "Foo::") it invokes RECURSE, passing in the symbol
399 name, and only recurses into the package if that sub returns true.
401 PREFIX is the name of the SYMREF you're walking.
405 # Walk CGI's symbol table calling print_subs on each symbol.
406 # Recurse only into CGI::Util::
407 walksymtable(\%CGI::, 'print_subs',
408 sub { $_[0] eq 'CGI::Util::' }, 'CGI::');
410 print_subs() is a B::GV method you have declared. Also see L<"B::GV
415 =head2 Functions Returning C<B::OP> objects or for walking op trees
417 For descriptions of the class hierarchy of these objects and the
418 methods that can be called on them, see below, L<"OVERVIEW OF
419 CLASSES"> and L<"OP-RELATED CLASSES">.
425 Returns the root op (i.e. an object in the appropriate B::OP-derived
426 class) of the main part of the Perl program.
430 Returns the starting op of the main part of the Perl program.
432 =item walkoptree(OP, METHOD)
434 Does a tree-walk of the syntax tree based at OP and calls METHOD on
435 each op it visits. Each node is visited before its children. If
436 C<walkoptree_debug> (see below) has been called to turn debugging on then
437 the method C<walkoptree_debug> is called on each op before METHOD is
440 =item walkoptree_debug(DEBUG)
442 Returns the current debugging flag for C<walkoptree>. If the optional
443 DEBUG argument is non-zero, it sets the debugging flag to that. See
444 the description of C<walkoptree> above for what the debugging flag
449 =head2 Miscellaneous Utility Functions
455 Return the PP function name (e.g. "pp_add") of op number OPNUM.
459 Returns a string in the form "0x..." representing the value of the
460 internal hash function used by perl on string STR.
464 Casts I to the internal I32 type used by that perl.
468 Does the equivalent of the C<-c> command-line option. Obviously, this
469 is only useful in a BEGIN block or else the flag is set too late.
473 Returns a double-quote-surrounded escaped version of STR which can
474 be used as a string in C source code.
476 =item perlstring(STR)
478 Returns a double-quote-surrounded escaped version of STR which can
479 be used as a string in Perl source code.
483 This function returns the string with the first character modified if it
484 is a control character. It converts it to ^X format first, so that "\cG"
485 becomes "^G". This is used internally by L<B::GV::SAFENAME|/SAFENAME>, but
486 you can call it directly.
490 Returns the class of an object without the part of the classname
491 preceding the first C<"::">. This is used to turn C<"B::UNOP"> into
492 C<"UNOP"> for example.
496 This used to provide support for the old 5.005 threading module. It now
501 =head2 Exported utility variables
507 my $op_type = $optype[$op_type_num];
509 A simple mapping of the op type number to its type (like 'COP' or 'BINOP').
511 =item @specialsv_name
513 my $sv_name = $specialsv_name[$sv_index];
515 Certain SV types are considered 'special'. They're represented by
516 B::SPECIAL and are referred to by a number from the specialsv_list.
517 This array maps that number back to the name of the SV (like 'Nullsv'
523 =head1 OVERVIEW OF CLASSES
525 The C structures used by Perl's internals to hold SV and OP
526 information (PVIV, AV, HV, ..., OP, SVOP, UNOP, ...) are modelled on a
527 class hierarchy and the C<B> module gives access to them via a true
528 object hierarchy. Structure fields which point to other objects
529 (whether types of SV or types of OP) are represented by the C<B>
530 module as Perl objects of the appropriate class.
532 The bulk of the C<B> module is the methods for accessing fields of
535 Note that all access is read-only. You cannot modify the internals by
536 using this module. Also, note that the B::OP and B::SV objects created
537 by this module are only valid for as long as the underlying objects
538 exist; their creation doesn't increase the reference counts of the
539 underlying objects. Trying to access the fields of a freed object will
540 give incomprehensible results, or worse.
542 =head2 SV-RELATED CLASSES
544 B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM (5.9.5 and
545 earlier), B::PVLV, B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes
546 correspond in the obvious way to the underlying C structures of similar names.
547 The inheritance hierarchy mimics the underlying C "inheritance". For the
548 5.10.x branch, (I<ie> 5.10.0, 5.10.1 I<etc>) this is:
552 +------------+------------+------------+
554 B::PV B::IV B::NV B::RV
566 +-----+-----+-----+-----+
568 B::AV B::GV B::HV B::CV B::IO
573 For 5.9.0 and earlier, PVLV is a direct subclass of PVMG, and BM is still
574 present as a distinct type, so the base of this diagram is
581 +------+-----+-----+-----+-----+-----+
583 B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO
588 For 5.11.0 and later, B::RV is abolished, and IVs can be used to store
589 references, and a new type B::REGEXP is introduced, giving this structure:
593 +------------+------------+
607 +-------+-------+---+---+-------+-------+
609 B::AV B::GV B::HV B::CV B::IO B::REGEXP
615 Access methods correspond to the underlying C macros for field access,
616 usually with the leading "class indication" prefix removed (Sv, Av,
617 Hv, ...). The leading prefix is only left in cases where its removal
618 would cause a clash in method name. For example, C<GvREFCNT> stays
619 as-is since its abbreviation would clash with the "superclass" method
620 C<REFCNT> (corresponding to the C function C<SvREFCNT>).
632 Returns a reference to the regular scalar corresponding to this
633 B::SV object. In other words, this method is the inverse operation
634 to the svref_2object() subroutine. This scalar and other data it points
635 at should be considered read-only: modifying them is neither safe nor
636 guaranteed to have a sensible effect.
646 Returns the value of the IV, I<interpreted as
647 a signed integer>. This will be misleading
648 if C<FLAGS & SVf_IVisUV>. Perhaps you want the
649 C<int_value> method instead?
657 This method returns the value of the IV as an integer.
658 It differs from C<IV> in that it returns the correct
659 value regardless of whether it's stored signed or
676 =item COP_SEQ_RANGE_LOW
678 =item COP_SEQ_RANGE_HIGH
680 These last two are only valid for pad name SVs. They only existed in the
681 B::NV class before Perl 5.22. In 5.22 they were moved to the B::PADNAME
700 This method is the one you usually want. It constructs a
701 string using the length and offset information in the struct:
702 for ordinary scalars it will return the string that you'd see
703 from Perl, even if it contains null characters.
707 Same as B::RV::RV, except that it will die() if the PV isn't
712 This method is less often useful. It assumes that the string
713 stored in the struct is null-terminated, and disregards the
716 It is the appropriate method to use if you need to get the name
717 of a lexical variable from a padname array. Lexical variable names
718 are always stored with a null terminator, and the length field
719 (CUR) is overloaded for other purposes and can't be relied on here.
723 This method returns the internal length field, which consists of the number
724 of internal bytes, not necessarily the number of logical characters.
728 This method returns the number of bytes allocated (via malloc) for storing
729 the string. This is 0 if the scalar does not "own" the string.
733 =head2 B::PVMG Methods
743 =head2 B::MAGIC Methods
751 Only valid on r-magic, returns the string that generated the regexp.
761 Will die() if called on r-magic.
767 Only valid on r-magic, returns the integer value of the REGEX stored
772 =head2 B::PVLV Methods
800 =head2 B::REGEXP Methods
812 The last two were added in Perl 5.22.
822 This method returns TRUE if the GP field of the GV is NULL.
828 This method returns the name of the glob, but if the first
829 character of the name is a control character, then it converts
830 it to ^X first, so that *^G would return "^G" rather than "\cG".
832 It's useful if you want to print out the name of a variable.
833 If you restrict yourself to globs which exist at compile-time
834 then the result ought to be unambiguous, because code like
835 C<${"^G"} = 1> is compiled as two ops - a constant string and
836 a dereference (rv2gv) - so that the glob is created at runtime.
838 If you're working with globs at runtime, and need to disambiguate
839 *^G from *{"^G"}, then you should use the raw NAME method.
871 This last one is present only in perl 5.22.0 and higher.
877 B::IO objects derive from IO objects and you will get more information from
878 the IO object itself.
882 $gvio = B::svref_2object(\*main::stdin)->IO;
883 $IO = $gvio->object_2svref();
912 A character symbolizing the type of IO Handle.
925 \0 closed internal handle
931 Takes one argument ( 'stdin' | 'stdout' | 'stderr' ) and returns true
932 if the IoIFP of the object is equal to the handle whose name was
933 passed as argument; i.e., $io->IsSTD('stderr') is true if
934 IoIFP($io) == PerlIO_stderr().
950 Like C<ARRAY>, but takes an index as an argument to get only one element,
951 rather than a list of all of them.
955 This method is deprecated if running under Perl 5.8, and is no longer present
956 if running under Perl 5.9
960 This method returns the AV specific
961 flags. In Perl 5.9 these are now stored
962 in with the main SV flags, so this method is no longer present.
984 Returns a B::PADLIST object under Perl 5.18 or higher, or a B::AV in
995 For constant subroutines, returns the constant SV returned by the subroutine.
1003 Returns the name of a lexical sub, otherwise C<undef>.
1007 =head2 B::HV Methods
1025 This method is not present if running under Perl 5.9, as the PMROOT
1026 information is no longer stored directly in the hash.
1030 =head2 OP-RELATED CLASSES
1032 C<B::OP>, C<B::UNOP>, C<B::UNOP_AUX>, C<B::BINOP>, C<B::LOGOP>,
1033 C<B::LISTOP>, C<B::PMOP>, C<B::SVOP>, C<B::PADOP>, C<B::PVOP>, C<B::LOOP>,
1034 C<B::COP>, C<B::METHOP>.
1036 These classes correspond in the obvious way to the underlying C
1037 structures of similar names. The inheritance hierarchy mimics the
1038 underlying C "inheritance":
1042 +----------+---------+--------+-------+---------+
1044 B::UNOP B::SVOP B::PADOP B::COP B::PVOP B::METHOP
1048 B::BINOP B::LOGOP B::UNOP_AUX
1057 Access methods correspond to the underlying C structure field names,
1058 with the leading "class indication" prefix (C<"op_">) removed.
1060 =head2 B::OP Methods
1062 These methods get the values of similarly named fields within the OP
1063 data structure. See top of C<op.h> for more info.
1073 Returns the OP's parent. If it has no parent, or if your perl wasn't built
1074 with C<-DPERL_OP_PARENT>, returns NULL.
1076 Note that the global variable C<$B::OP::does_parent> is undefined on older
1077 perls that don't support the C<parent> method, is defined but false on
1078 perls that support the method but were built without C<-DPERL_OP_PARENT>,
1079 and is true otherwise.
1083 This returns the op name as a string (e.g. "add", "rv2av").
1087 This returns the function name as a string (e.g. "PL_ppaddr[OP_ADD]",
1088 "PL_ppaddr[OP_RV2AV]").
1092 This returns the op description from the global C PL_op_desc array
1093 (e.g. "addition" "array deref").
1109 =head2 B::UNOP Method
1117 =head2 B::UNOP_AUX Methods (since 5.22)
1123 This returns a list of the elements of the op's aux data structure,
1124 or a null list if there is no aux. What will be returned depends on the
1125 object's type, but will typically be a collection of C<B::IV>, C<B::GV>,
1126 etc. objects. C<cv> is the C<B::CV> object representing the sub that the
1127 op is contained within.
1131 This returns a textual representation of the object (likely to b useful
1132 for deparsing and debugging), or an empty string if the op type doesn't
1133 support this. C<cv> is the C<B::CV> object representing the sub that the
1134 op is contained within.
1138 =head2 B::BINOP Method
1146 =head2 B::LOGOP Method
1154 =head2 B::LISTOP Method
1162 =head2 B::PMOP Methods
1172 Only up to Perl 5.9.4
1184 Only when perl was compiled with ithreads.
1192 Added in perl 5.22, this method returns the B::REGEXP associated with the
1193 op. While PMOPs do not actually have C<pmregexp> fields under threaded
1194 builds, this method returns the regexp under threads nonetheless, for
1199 =head2 B::SVOP Methods
1209 =head2 B::PADOP Method
1217 =head2 B::PVOP Method
1225 =head2 B::LOOP Methods
1237 =head2 B::COP Methods
1239 The C<B::COP> class is used for "nextstate" and "dbstate" ops. As of Perl
1240 5.22, it is also used for "null" ops that started out as COPs.
1250 =item stashoff (threaded only)
1270 =head2 B::METHOP Methods (Since Perl 5.22)
1280 =head2 PAD-RELATED CLASSES
1282 Perl 5.18 introduced a new class, B::PADLIST, returned by B::CV's
1285 Perl 5.22 introduced the B::PADNAMELIST and B::PADNAME classes.
1287 =head2 B::PADLIST Methods
1295 A list of pads. The first one contains the names.
1297 The first one is a B::PADNAMELIST under Perl 5.22, and a B::AV under
1298 earlier versions. The rest are currently B::AV objects, but that could
1299 change in future versions.
1303 Like C<ARRAY>, but takes an index as an argument to get only one element,
1304 rather than a list of all of them.
1308 This method, introduced in 5.22, returns the B::PADNAMELIST. It is
1309 equivalent to C<ARRAYelt> with a 0 argument.
1315 This method, introduced in 5.22, returns an ID shared by clones of the same
1320 This method, also added in 5.22, returns the ID of the outer padlist.
1324 =head2 B::PADNAMELIST Methods
1334 These two methods return the pad names, using B::SPECIAL objects for null
1335 pointers and B::PADNAME objects otherwise.
1341 =head2 B::PADNAME Methods
1355 For backward-compatibility, if the PADNAMEt_OUTER flag is set, the FLAGS
1356 method adds the SVf_FAKE flag, too.
1360 A B::HV object representing the stash for a typed lexical.
1364 A backward-compatibility alias for TYPE.
1368 A B::HV object representing the stash for 'our' variables.
1372 The prototype CV for a 'my' sub.
1374 =item COP_SEQ_RANGE_LOW
1376 =item COP_SEQ_RANGE_HIGH
1378 Sequence numbers representing the scope within which a lexical is visible.
1379 Meaningless if PADNAMEt_OUTER is set.
1381 =item PARENT_PAD_INDEX
1383 Only meaningful if PADNAMEt_OUTER is set.
1385 =item PARENT_FAKELEX_FLAGS
1387 Only meaningful if PADNAMEt_OUTER is set.
1393 Although the optree is read-only, there is an overlay facility that allows
1394 you to override what values the various B::*OP methods return for a
1395 particular op. C<$B::overlay> should be set to reference a two-deep hash:
1396 indexed by OP address, then method name. Whenever a an op method is
1397 called, the value in the hash is returned if it exists. This facility is
1398 used by B::Deparse to "undo" some optimisations. For example:
1401 local $B::overlay = {};
1403 if ($op->name eq "foo") {
1404 $B::overlay->{$$op} = {
1406 next => $op->next->next,
1410 $op->name # returns "bar"
1411 $op->next # returns the next op but one
1416 Malcolm Beattie, C<mbeattie@sable.ox.ac.uk>