1Check implicit loading of features with use VERSION. 2 3__END__ 4# Standard feature bundle 5use feature ":5.10"; 6say "Hello", "world"; 7EXPECT 8Helloworld 9######## 10# VERSION requirement, dotted notation 11use 5.9.5; 12say "Hello", "world"; 13EXPECT 14Helloworld 15######## 16# VERSION requirement, v-dotted notation 17use v5.9.5; 18say "Hello", "world"; 19EXPECT 20Helloworld 21######## 22# VERSION requirement, decimal notation 23use 5.009005; 24say "Helloworld"; 25EXPECT 26Helloworld 27######## 28# VERSION requirement, doesn't load anything with require 29require 5.9.5; 30print "<".$INC{"feature.pm"}.">\n"; 31EXPECT 32<> 33######## 34# VERSION requirement in eval {} 35eval { 36 use 5.9.5; 37 say "Hello", "world"; 38} 39EXPECT 40Helloworld 41######## 42# VERSION requirement in eval "" 43eval q{ 44 use 5.9.5; 45 say "Hello", "world"; 46} 47EXPECT 48Helloworld 49######## 50# VERSION requirement in BEGIN 51BEGIN { 52 use 5.9.5; 53 say "Hello", "world"; 54} 55EXPECT 56Helloworld 57######## 58# no implicit features with 'no' 59eval "no " . ($]+1); print $@; 60EXPECT 61######## 62# lower version after higher version 63sub evalbytes { print "evalbytes sub\n" } 64sub say { print "say sub\n" } 65use 5.015; 66evalbytes "say 'yes'"; 67use 5.014; 68evalbytes; 69use 5; 70say "no" 71EXPECT 72yes 73evalbytes sub 74say sub 75######## 76# No $[ under 5.15 77# SKIP ? not defined DynaLoader::boot_DynaLoader 78use v5.14; 79no warnings 'deprecated'; 80$[ = 1; 81print qw[a b c][2], "\n"; 82use v5.15; 83print qw[a b c][2], "\n"; 84EXPECT 85b 86c 87######## 88# $[ under < 5.10 89# SKIP ? not defined DynaLoader::boot_DynaLoader 90use feature 'say'; # make sure it is loaded and modifies %^H; we are test- 91use v5.8.8; # ing to make sure it does not disable $[ 92no warnings 'deprecated'; 93$[ = 1; 94print qw[a b c][2], "\n"; 95EXPECT 96b 97######## 98# $[ under < 5.10 after use v5.15 99# SKIP ? not defined DynaLoader::boot_DynaLoader 100use v5.15; 101use v5.8.8; 102no warnings 'deprecated'; 103$[ = 1; 104print qw[a b c][2], "\n"; 105EXPECT 106b 107######## 108# Implicit unicode_string feature 109use v5.14; 110print 'ss' =~ /\xdf/i ? "ok\n" : "nok\n"; 111use v5.8.8; 112print 'ss' =~ /\xdf/i ? "ok\n" : "nok\n"; 113EXPECT 114ok 115nok 116######## 117# Implicit unicode_eval feature 118use v5.15; 119print eval "use utf8; q|\xc5\xbf|" eq "\xc5\xbf" ? "ok\n" : "nok\n"; 120use v5.8.8; 121print eval "use utf8; q|\xc5\xbf|" eq "\x{17f}" ? "ok\n" : "nok\n"; 122EXPECT 123ok 124ok 125