No more late changes, dammit
[p5sagit/p5-mst-13.2.git] / ext / B / B.pm
index 564b675..0274711 100644 (file)
@@ -7,7 +7,7 @@
 #
 package B;
 
-our $VERSION = '1.01';
+our $VERSION = '1.07';
 
 use XSLoader ();
 require Exporter;
@@ -21,7 +21,9 @@ require Exporter;
                amagic_generation perlstring
                walkoptree_slow walkoptree walkoptree_exec walksymtable
                parents comppadlist sv_undef compile_stats timing_info
-               begin_av init_av check_av end_av regex_padav);
+               begin_av init_av check_av end_av regex_padav dowarn
+               defstash curstash warnhook diehook inc_gv
+               );
 
 sub OPf_KIDS ();
 use strict;
@@ -34,7 +36,8 @@ use strict;
 @B::PVIV::ISA = qw(B::PV B::IV);
 @B::PVNV::ISA = qw(B::PV B::NV);
 @B::PVMG::ISA = 'B::PVNV';
-@B::PVLV::ISA = 'B::PVMG';
+# Change in the inheritance hierarchy post 5.8
+@B::PVLV::ISA = $] > 5.009 ? 'B::GV' : 'B::PVMG';
 @B::BM::ISA = 'B::PVMG';
 @B::AV::ISA = 'B::PVMG';
 @B::GV::ISA = 'B::PVMG';
@@ -51,7 +54,6 @@ use strict;
 @B::SVOP::ISA = 'B::OP';
 @B::PADOP::ISA = 'B::OP';
 @B::PVOP::ISA = 'B::OP';
-@B::CVOP::ISA = 'B::OP';
 @B::LOOP::ISA = 'B::LISTOP';
 @B::PMOP::ISA = 'B::LISTOP';
 @B::COP::ISA = 'B::OP';
@@ -176,7 +178,7 @@ sub walkoptree_exec {
        $op->$method($level);
        $ppname = $op->name;
        if ($ppname =~
-           /^(or|and|mapwhile|grepwhile|entertry|range|cond_expr)$/)
+           /^(d?or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/)
        {
            print $prefix, uc($1), " => {\n";
            walkoptree_exec($op->other, $method, $level + 1);
@@ -370,7 +372,7 @@ which can then be followed with the other access methods.
 
 Returns the SV object corresponding to the C variable C<amagic_generation>.
 
-=item C<init_av>
+=item init_av
 
 Returns the AV object (i.e. in class B::AV) representing INIT blocks.
 
@@ -394,7 +396,7 @@ Returns the AV object (i.e. in class B::AV) of the global comppadlist.
 
 Only when perl was compiled with ithreads.
 
-=item C<main_cv>
+=item main_cv
 
 Return the (faked) CV corresponding to the main part of the Perl
 program.
@@ -528,7 +530,8 @@ using this module.
 B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV,
 B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in
 the obvious way to the underlying C structures of similar names. The
-inheritance hierarchy mimics the underlying C "inheritance":
+inheritance hierarchy mimics the underlying C "inheritance". For 5.9 and
+later this is:
 
                              B::SV
                                |
@@ -546,6 +549,20 @@ inheritance hierarchy mimics the underlying C "inheritance":
                            |
                         B::PVMG
                            |
+                +-----+----+------+-----+-----+
+                |     |    |      |     |     |
+              B::BM B::AV B::GV B::HV B::CV B::IO
+                           |            |
+                        B::PVLV         |
+                                      B::FM
+
+
+For 5.8 and earlier, PVLV is a direct subclass of PVMG, so the base of this
+diagram is
+
+                           |
+                        B::PVMG
+                           |
          +------+-----+----+------+-----+-----+
          |      |     |    |      |     |     |
       B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO
@@ -569,6 +586,14 @@ C<REFCNT> (corresponding to the C function C<SvREFCNT>).
 
 =item FLAGS
 
+=item object_2svref
+
+Returns a reference to the regular scalar corresponding to this
+B::SV object. In other words, this method is the inverse operation
+to the svref_2object() subroutine. This scalar and other data it points
+at should be considered read-only: modifying them is neither safe nor
+guaranteed to have a sensible effect.
+
 =back
 
 =head2 B::IV Methods
@@ -819,6 +844,11 @@ IoIFP($io) == PerlIO_stdin() ).
 
 =item ARRAY
 
+=item ARRAYelt
+
+Like C<ARRAY>, but takes an index as an argument to get only one element,
+rather than a list of all of them.
+
 =item AvFLAGS
 
 =back
@@ -843,6 +873,8 @@ IoIFP($io) == PerlIO_stdin() ).
 
 =item OUTSIDE
 
+=item OUTSIDE_SEQ
+
 =item XSUB
 
 =item XSUBANY
@@ -878,7 +910,7 @@ For constant subroutines, returns the constant SV returned by the subroutine.
 =head2 OP-RELATED CLASSES
 
 C<B::OP>, C<B::UNOP>, C<B::BINOP>, C<B::LOGOP>, C<B::LISTOP>, C<B::PMOP>,
-C<B::SVOP>, C<B::PADOP>, C<B::PVOP>, C<B::CVOP>, C<B::LOOP>, C<B::COP>.
+C<B::SVOP>, C<B::PADOP>, C<B::PVOP>, C<B::LOOP>, C<B::COP>.
 
 These classes correspond in the obvious way to the underlying C
 structures of similar names. The inheritance hierarchy mimics the
@@ -886,9 +918,9 @@ underlying C "inheritance":
 
                                  B::OP
                                    |
-                   +---------------+--------+--------+------+
-                   |               |        |        |      |
-                B::UNOP          B::SVOP B::PADOP B::CVOP B::COP
+                   +---------------+--------+--------+
+                   |               |        |        |
+                B::UNOP          B::SVOP B::PADOP  B::COP
                  ,'  `-.
                 /       `--.
            B::BINOP     B::LOGOP
@@ -904,6 +936,9 @@ with the leading "class indication" prefix (C<"op_">) removed.
 
 =head2 B::OP Methods
 
+These methods get the values of similarly named fields within the OP
+data structure.  See top of C<op.h> for more info.
+
 =over 4
 
 =item next
@@ -928,12 +963,16 @@ This returns the op description from the global C PL_op_desc array
 
 =item type
 
-=item seq
+=item opt
+
+=item static
 
 =item flags
 
 =item private
 
+=item spare
+
 =back
 
 =head2 B::UNOP METHOD
@@ -988,7 +1027,7 @@ This returns the op description from the global C PL_op_desc array
 
 =item precomp
 
-=item pmoffet
+=item pmoffset
 
 Only when perl was compiled with ithreads.
 
@@ -1040,6 +1079,8 @@ Only when perl was compiled with ithreads.
 
 =item stash
 
+=item stashpv
+
 =item file
 
 =item cop_seq
@@ -1048,6 +1089,10 @@ Only when perl was compiled with ithreads.
 
 =item line
 
+=item warnings
+
+=item io
+
 =back