diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-11-04 11:39:19 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-11-04 11:39:19 +0000 |
commit | 744aaba0598b45009977ebe8c7d6dc376288e2e4 (patch) | |
tree | e3fc9b69cb4268691ba9e46069aedc368c4003d1 /ext | |
parent | 4bf035ef9384dfbe85a500502cc3866c87c59b26 (diff) | |
download | perl-744aaba0598b45009977ebe8c7d6dc376288e2e4.tar.gz |
Avoid needing to stub B::OPf_KIDS by loading the XS earlier.
This will also inline the constant in the code of walkoptree_slow().
Things are complicated by the fact that B's BOOT code needs $VERSION set, and
pushes to @EXPORT_OK.
Move the 'use strict' much earlier.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B.pm | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/ext/B/B.pm b/ext/B/B.pm index 3747de7995..4cd55459e1 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -6,28 +6,36 @@ # License or the Artistic License, as specified in the README file. # package B; +use strict; -our $VERSION = '1.25'; - -require XSLoader; require Exporter; -@ISA = qw(Exporter); +@B::ISA = qw(Exporter); # walkoptree_slow comes from B.pm (you are there), # walkoptree comes from B.xs -@EXPORT_OK = qw(minus_c ppname save_BEGINs - class peekop cast_I32 cstring cchar hash threadsv_names - main_root main_start main_cv svref_2object opnumber - sub_generation 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 dowarn defstash - curstash warnhook diehook inc_gv @optype @specialsv_name - ); -push @EXPORT_OK, qw(unitcheck_av) if $] > 5.009; - -sub OPf_KIDS (); -use strict; + +BEGIN { + $B::VERSION = '1.25'; + + @B::EXPORT_OK = qw(minus_c ppname save_BEGINs + class peekop cast_I32 cstring cchar hash threadsv_names + main_root main_start main_cv svref_2object opnumber + sub_generation 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 dowarn + defstash curstash warnhook diehook inc_gv @optype + @specialsv_name + ); + push @B::EXPORT_OK, qw(unitcheck_av) if $] > 5.009; + + # All the above in this BEGIN, because our BOOT code needs $VERSION set, + # and will append to @EXPORT_OK. And we need to run the BOOT code before + # we see OPf_KIDS below. + require XSLoader; + XSLoader::load(); +} + @B::SV::ISA = 'B::OBJECT'; @B::NULL::ISA = 'B::SV'; @B::PV::ISA = 'B::SV'; @@ -315,8 +323,6 @@ sub walksymtable { } } -XSLoader::load(); - 1; __END__ |