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 72Downgrading a use VERSION declaration to below v5.11 is deprecated, and will become fatal in Perl 5.40 at - line 8. 73yes 74evalbytes sub 75say sub 76######## 77# Implicit unicode_string feature 78use v5.14; 79my $sharp_s = chr utf8::unicode_to_native(0xdf); 80print 'ss' =~ /$sharp_s/i ? "ok\n" : "nok\n"; 81use v5.8.8; 82print 'ss' =~ /$sharp_s/i ? "ok\n" : "nok\n"; 83EXPECT 84Downgrading a use VERSION declaration to below v5.11 is deprecated, and will become fatal in Perl 5.40 at - line 5. 85ok 86nok 87######## 88# Implicit unicode_eval feature 89use v5.15; 90require '../../t/charset_tools.pl'; 91my $long_s = byte_utf8a_to_utf8n("\xc5\xbf"); 92print eval "use utf8; q|$long_s|" eq $long_s ? "ok\n" : "nok\n"; 93use v5.8.8; 94print eval "use utf8; q|$long_s|" eq "\x{17f}" ? "ok\n" : "nok\n"; 95EXPECT 96Downgrading a use VERSION declaration to below v5.11 is deprecated, and will become fatal in Perl 5.40 at - line 6. 97ok 98ok 99