use VERSION now checks whether HINT_LOCALIZE_HH is set, which indi-
cates that %^H has been modified. If it is set, it does ‘no feature’
first, regardless of the version number.
Some tests were checking that feature.pm is not loaded for use 5.8.8.
Now it is sometimes, particularly if PERL_UNICODE has been set, as it
adds keys to %^H.
For now, I’ve tweaked the tests. It would be nice if version declara-
tions could load and unload features without loading feature.pm, just
as they do with strictures.
EXPECT
Helloworld
########
-# VERSION requirement, doesn't load anything for < 5.9.5
+# VERSION requirement, doesn't call feature->import for < 5.9.5
+BEGIN { ++$INC{"feature.pm"} }
+sub feature::import { print "improting\n" }
use 5.8.8;
-print "<".$INC{"feature.pm"}.">\n";
EXPECT
-<>
########
# VERSION requirement, doesn't load anything with require
require 5.9.5;
eval "use Foo::Bar";
is( $r, join($dirsep, "Foo", "Bar.pm") );
-eval "use 5.006";
-is( $r, "5.006" );
+# Under PERL_UNICODE, %^H is set, causing Perl_utilize to require
+# feature.pm after 5.006, in order to turn off features. Stop that
+# from interfering with this test by unsetting HINT_LOCALIZE_HH.
+{
+ BEGIN { $^H &= ~0x00020000 } # HINT_LOCALIZE_HH
+ eval "use 5.006";
+ is( $r, "5.006" );
+}
{
local $_ = 'foo.pm';