diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-12-15 16:26:16 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-15 16:26:16 -0800 |
commit | 7d69d4a61be1619f90910462eac42234c874712e (patch) | |
tree | 6c7be0f836c3bb4cd3b20c091c4362a22e8c02fd /perl.h | |
parent | b22bbcf0786b5b4b9edfde241ba29141bb99f219 (diff) | |
download | perl-7d69d4a61be1619f90910462eac42234c874712e.tar.gz |
Disable $[ under 5.16
This adds the array_base feature to feature.pm
Perl_feature_is_enabled has been modified to use PL_curcop, rather
than PL_hintgv, so it can work with run-time hints as well.
(PL_curcop holds the current state op at run time, and &PL_compiling
at compile time, so it works for both.) The hints in $^H are not
stored in the same place at compile time and run time, so the FEATURE_IS_ENABLED macro has been modified to check first whether
PL_curop == &PL_compiling.
Since array_base is on by default with no hint for it in %^H, it is
a ‘negative’ feature, whose entry in %^H turns it off. feature.pm
has been modified to support such negative features. The new FEATURE_IS_ENABLED_d can check whether such default features
are enabled.
This does make things less efficient, as every version declaration
now loads feature.pm to disable all features (including turning off
array_base, which entails adding an entry to %^H) before loading the
new bundle. I have plans to make this more efficient.
Diffstat (limited to 'perl.h')
-rw-r--r-- | perl.h | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -5745,10 +5745,15 @@ extern void moncontrol(int); #define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE #define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII -#ifdef PERL_CORE +#if defined(PERL_CORE) || defined(PERL_EXT) # define FEATURE_IS_ENABLED(name) \ - ((0 != (PL_hints & HINT_LOCALIZE_HH)) \ - && Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name))) + (((PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints) \ + & HINT_LOCALIZE_HH) \ + && Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name), 0)) +# define FEATURE_IS_ENABLED_d(name) \ + (!((PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints) \ + & HINT_LOCALIZE_HH) \ + || Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name), 1)) /* The longest string we pass in. */ # define MAX_FEATURE_LEN (sizeof("unicode_strings")-1) #endif |