1*f2a19305Safresh1#!./perl -T 2256a93a4Safresh1 3256a93a4Safresh1BEGIN { 4256a93a4Safresh1 chdir 't' if -d 't'; 5256a93a4Safresh1 require './test.pl'; 6256a93a4Safresh1 set_up_inc('../lib'); 7256a93a4Safresh1} 8256a93a4Safresh1 9*f2a19305Safresh1use v5.36; 10256a93a4Safresh1no warnings 'experimental::builtin'; 11256a93a4Safresh1 12256a93a4Safresh1package FetchStoreCounter { 13*f2a19305Safresh1 sub TIESCALAR($class, @args) { bless \@args, $class } 14*f2a19305Safresh1 15*f2a19305Safresh1 sub FETCH($self) { $self->[0]->$*++ } 16*f2a19305Safresh1 sub STORE($self, $) { $self->[1]->$*++ } 17256a93a4Safresh1} 18256a93a4Safresh1 19256a93a4Safresh1# booleans 20256a93a4Safresh1{ 21256a93a4Safresh1 use builtin qw( true false is_bool ); 22256a93a4Safresh1 23256a93a4Safresh1 ok(true, 'true is true'); 24256a93a4Safresh1 ok(!false, 'false is false'); 25256a93a4Safresh1 26256a93a4Safresh1 ok(is_bool(true), 'true is bool'); 27256a93a4Safresh1 ok(is_bool(false), 'false is bool'); 28256a93a4Safresh1 ok(!is_bool(undef), 'undef is not bool'); 29256a93a4Safresh1 ok(!is_bool(1), '1 is not bool'); 30256a93a4Safresh1 ok(!is_bool(""), 'empty is not bool'); 31256a93a4Safresh1 32256a93a4Safresh1 my $truevar = (5 == 5); 33256a93a4Safresh1 my $falsevar = (5 == 6); 34256a93a4Safresh1 35256a93a4Safresh1 ok(is_bool($truevar), '$truevar is bool'); 36256a93a4Safresh1 ok(is_bool($falsevar), '$falsevar is bool'); 37256a93a4Safresh1 38256a93a4Safresh1 ok(is_bool(is_bool(true)), 'is_bool true is bool'); 39256a93a4Safresh1 ok(is_bool(is_bool(123)), 'is_bool false is bool'); 40256a93a4Safresh1 41256a93a4Safresh1 # Invokes magic 42256a93a4Safresh1 43256a93a4Safresh1 tie my $tied, FetchStoreCounter => (\my $fetchcount, \my $storecount); 44256a93a4Safresh1 45256a93a4Safresh1 my $_dummy = is_bool($tied); 46256a93a4Safresh1 is($fetchcount, 1, 'is_bool() invokes FETCH magic'); 47256a93a4Safresh1 48256a93a4Safresh1 $tied = is_bool(false); 49*f2a19305Safresh1 is($storecount, 1, 'is_bool() invokes STORE magic'); 50*f2a19305Safresh1 51*f2a19305Safresh1 is(prototype(\&builtin::is_bool), '$', 'is_bool prototype'); 52256a93a4Safresh1} 53256a93a4Safresh1 54256a93a4Safresh1# weakrefs 55256a93a4Safresh1{ 56256a93a4Safresh1 use builtin qw( is_weak weaken unweaken ); 57256a93a4Safresh1 58256a93a4Safresh1 my $arr = []; 59256a93a4Safresh1 my $ref = $arr; 60256a93a4Safresh1 61256a93a4Safresh1 ok(!is_weak($ref), 'ref is not weak initially'); 62256a93a4Safresh1 63256a93a4Safresh1 weaken($ref); 64256a93a4Safresh1 ok(is_weak($ref), 'ref is weak after weaken()'); 65256a93a4Safresh1 66256a93a4Safresh1 unweaken($ref); 67256a93a4Safresh1 ok(!is_weak($ref), 'ref is not weak after unweaken()'); 68256a93a4Safresh1 69256a93a4Safresh1 weaken($ref); 70256a93a4Safresh1 undef $arr; 71256a93a4Safresh1 is($ref, undef, 'ref is now undef after arr is cleared'); 72*f2a19305Safresh1 73*f2a19305Safresh1 is(prototype(\&builtin::weaken), '$', 'weaken prototype'); 74*f2a19305Safresh1 is(prototype(\&builtin::unweaken), '$', 'unweaken prototype'); 75*f2a19305Safresh1 is(prototype(\&builtin::is_weak), '$', 'is_weak prototype'); 76256a93a4Safresh1} 77256a93a4Safresh1 78256a93a4Safresh1# reference queries 79256a93a4Safresh1{ 80256a93a4Safresh1 use builtin qw( refaddr reftype blessed ); 81256a93a4Safresh1 82256a93a4Safresh1 my $arr = []; 83256a93a4Safresh1 my $obj = bless [], "Object"; 84256a93a4Safresh1 85256a93a4Safresh1 is(refaddr($arr), $arr+0, 'refaddr yields same as ref in numeric context'); 86256a93a4Safresh1 is(refaddr("not a ref"), undef, 'refaddr yields undef for non-reference'); 87256a93a4Safresh1 88256a93a4Safresh1 is(reftype($arr), "ARRAY", 'reftype yields type string'); 89256a93a4Safresh1 is(reftype($obj), "ARRAY", 'reftype yields basic container type for blessed object'); 90256a93a4Safresh1 is(reftype("not a ref"), undef, 'reftype yields undef for non-reference'); 91256a93a4Safresh1 92256a93a4Safresh1 is(blessed($arr), undef, 'blessed yields undef for non-object'); 93256a93a4Safresh1 is(blessed($obj), "Object", 'blessed yields package name for object'); 94256a93a4Safresh1 95256a93a4Safresh1 # blessed() as a boolean 96256a93a4Safresh1 is(blessed($obj) ? "YES" : "NO", "YES", 'blessed in boolean context still works'); 97256a93a4Safresh1 98256a93a4Safresh1 # blessed() appears false as a boolean on package "0" 99256a93a4Safresh1 is(blessed(bless [], "0") ? "YES" : "NO", "NO", 'blessed in boolean context handles "0" cornercase'); 100*f2a19305Safresh1 101*f2a19305Safresh1 is(prototype(\&builtin::blessed), '$', 'blessed prototype'); 102*f2a19305Safresh1 is(prototype(\&builtin::refaddr), '$', 'refaddr prototype'); 103*f2a19305Safresh1 is(prototype(\&builtin::reftype), '$', 'reftype prototype'); 104256a93a4Safresh1} 105256a93a4Safresh1 106256a93a4Safresh1# created_as_... 107256a93a4Safresh1{ 108256a93a4Safresh1 use builtin qw( created_as_string created_as_number ); 109256a93a4Safresh1 110256a93a4Safresh1 # some literal constants 111256a93a4Safresh1 ok(!created_as_string(undef), 'undef created as !string'); 112256a93a4Safresh1 ok(!created_as_number(undef), 'undef created as !number'); 113256a93a4Safresh1 114256a93a4Safresh1 ok( created_as_string("abc"), 'abc created as string'); 115256a93a4Safresh1 ok(!created_as_number("abc"), 'abc created as number'); 116256a93a4Safresh1 117256a93a4Safresh1 ok(!created_as_string(123), '123 created as !string'); 118256a93a4Safresh1 ok( created_as_number(123), '123 created as !number'); 119256a93a4Safresh1 120256a93a4Safresh1 ok(!created_as_string(1.23), '1.23 created as !string'); 121256a93a4Safresh1 ok( created_as_number(1.23), '1.23 created as !number'); 122256a93a4Safresh1 123256a93a4Safresh1 ok(!created_as_string([]), '[] created as !string'); 124256a93a4Safresh1 ok(!created_as_number([]), '[] created as !number'); 125256a93a4Safresh1 126256a93a4Safresh1 ok(!created_as_string(builtin::true), 'true created as !string'); 127256a93a4Safresh1 ok(!created_as_number(builtin::true), 'true created as !number'); 128256a93a4Safresh1 129256a93a4Safresh1 ok(builtin::is_bool(created_as_string(0)), 'created_as_string returns bool'); 130256a93a4Safresh1 ok(builtin::is_bool(created_as_number(0)), 'created_as_number returns bool'); 131256a93a4Safresh1 132256a93a4Safresh1 # variables 133256a93a4Safresh1 my $just_pv = "def"; 134256a93a4Safresh1 ok( created_as_string($just_pv), 'def created as string'); 135256a93a4Safresh1 ok(!created_as_number($just_pv), 'def created as number'); 136256a93a4Safresh1 137256a93a4Safresh1 my $just_iv = 456; 138256a93a4Safresh1 ok(!created_as_string($just_iv), '456 created as string'); 139256a93a4Safresh1 ok( created_as_number($just_iv), '456 created as number'); 140256a93a4Safresh1 141256a93a4Safresh1 my $just_nv = 4.56; 142256a93a4Safresh1 ok(!created_as_string($just_nv), '456 created as string'); 143256a93a4Safresh1 ok( created_as_number($just_nv), '456 created as number'); 144256a93a4Safresh1 145256a93a4Safresh1 # variables reused 146256a93a4Safresh1 my $originally_pv = "1"; 147256a93a4Safresh1 my $pv_as_iv = $originally_pv + 0; 148256a93a4Safresh1 ok( created_as_string($originally_pv), 'PV reused as IV created as string'); 149256a93a4Safresh1 ok(!created_as_number($originally_pv), 'PV reused as IV created as !number'); 150256a93a4Safresh1 ok(!created_as_string($pv_as_iv), 'New number from PV created as !string'); 151256a93a4Safresh1 ok( created_as_number($pv_as_iv), 'New number from PV created as number'); 152256a93a4Safresh1 153256a93a4Safresh1 my $originally_iv = 1; 154256a93a4Safresh1 my $iv_as_pv = "$originally_iv"; 155256a93a4Safresh1 ok(!created_as_string($originally_iv), 'IV reused as PV created as !string'); 156256a93a4Safresh1 ok( created_as_number($originally_iv), 'IV reused as PV created as number'); 157256a93a4Safresh1 ok( created_as_string($iv_as_pv), 'New string from IV created as string'); 158256a93a4Safresh1 ok(!created_as_number($iv_as_pv), 'New string from IV created as !number'); 159256a93a4Safresh1 160256a93a4Safresh1 my $originally_nv = 1.1; 161256a93a4Safresh1 my $nv_as_pv = "$originally_nv"; 162256a93a4Safresh1 ok(!created_as_string($originally_nv), 'NV reused as PV created as !string'); 163256a93a4Safresh1 ok( created_as_number($originally_nv), 'NV reused as PV created as number'); 164256a93a4Safresh1 ok( created_as_string($nv_as_pv), 'New string from NV created as string'); 165256a93a4Safresh1 ok(!created_as_number($nv_as_pv), 'New string from NV created as !number'); 166256a93a4Safresh1 167256a93a4Safresh1 # magic 168256a93a4Safresh1 local $1; 169256a93a4Safresh1 "hello" =~ m/(.*)/; 170256a93a4Safresh1 ok(created_as_string($1), 'magic string'); 171*f2a19305Safresh1 172*f2a19305Safresh1 is(prototype(\&builtin::created_as_string), '$', 'created_as_string prototype'); 173*f2a19305Safresh1 is(prototype(\&builtin::created_as_number), '$', 'created_as_number prototype'); 174256a93a4Safresh1} 175256a93a4Safresh1 176256a93a4Safresh1# ceil, floor 177256a93a4Safresh1{ 178256a93a4Safresh1 use builtin qw( ceil floor ); 179256a93a4Safresh1 180256a93a4Safresh1 cmp_ok(ceil(1.5), '==', 2, 'ceil(1.5) == 2'); 181256a93a4Safresh1 cmp_ok(floor(1.5), '==', 1, 'floor(1.5) == 1'); 182256a93a4Safresh1 183256a93a4Safresh1 # Invokes magic 184256a93a4Safresh1 185256a93a4Safresh1 tie my $tied, FetchStoreCounter => (\my $fetchcount, \my $storecount); 186256a93a4Safresh1 187256a93a4Safresh1 my $_dummy = ceil($tied); 188256a93a4Safresh1 is($fetchcount, 1, 'ceil() invokes FETCH magic'); 189256a93a4Safresh1 190256a93a4Safresh1 $tied = ceil(1.1); 191256a93a4Safresh1 is($storecount, 1, 'ceil() TARG invokes STORE magic'); 192256a93a4Safresh1 193256a93a4Safresh1 $fetchcount = $storecount = 0; 194256a93a4Safresh1 tie $tied, FetchStoreCounter => (\$fetchcount, \$storecount); 195256a93a4Safresh1 196256a93a4Safresh1 $_dummy = floor($tied); 197256a93a4Safresh1 is($fetchcount, 1, 'floor() invokes FETCH magic'); 198256a93a4Safresh1 199256a93a4Safresh1 $tied = floor(1.1); 200256a93a4Safresh1 is($storecount, 1, 'floor() TARG invokes STORE magic'); 201*f2a19305Safresh1 202*f2a19305Safresh1 is(prototype(\&builtin::ceil), '$', 'ceil prototype'); 203*f2a19305Safresh1 is(prototype(\&builtin::floor), '$', 'floor prototype'); 204256a93a4Safresh1} 205256a93a4Safresh1 206256a93a4Safresh1# imports are lexical; should not be visible here 207256a93a4Safresh1{ 208256a93a4Safresh1 my $ok = eval 'true()'; my $e = $@; 209256a93a4Safresh1 ok(!$ok, 'true() not visible outside of lexical scope'); 210256a93a4Safresh1 like($e, qr/^Undefined subroutine &main::true called at /, 'failure from true() not visible'); 211256a93a4Safresh1} 212256a93a4Safresh1 213256a93a4Safresh1# lexical imports work fine in a variety of situations 214256a93a4Safresh1{ 215256a93a4Safresh1 sub regularfunc { 216256a93a4Safresh1 use builtin 'true'; 217256a93a4Safresh1 return true; 218256a93a4Safresh1 } 219256a93a4Safresh1 ok(regularfunc(), 'true in regular sub'); 220256a93a4Safresh1 221256a93a4Safresh1 my sub lexicalfunc { 222256a93a4Safresh1 use builtin 'true'; 223256a93a4Safresh1 return true; 224256a93a4Safresh1 } 225256a93a4Safresh1 ok(lexicalfunc(), 'true in lexical sub'); 226256a93a4Safresh1 227256a93a4Safresh1 my $coderef = sub { 228256a93a4Safresh1 use builtin 'true'; 229256a93a4Safresh1 return true; 230256a93a4Safresh1 }; 231256a93a4Safresh1 ok($coderef->(), 'true in anon sub'); 232256a93a4Safresh1 233256a93a4Safresh1 sub recursefunc { 234256a93a4Safresh1 use builtin 'true'; 235256a93a4Safresh1 return recursefunc() if @_; 236256a93a4Safresh1 return true; 237256a93a4Safresh1 } 238256a93a4Safresh1 ok(recursefunc("rec"), 'true in self-recursive sub'); 239256a93a4Safresh1 240256a93a4Safresh1 my $recursecoderef = sub { 241256a93a4Safresh1 use feature 'current_sub'; 242256a93a4Safresh1 use builtin 'true'; 243256a93a4Safresh1 return __SUB__->() if @_; 244256a93a4Safresh1 return true; 245256a93a4Safresh1 }; 246256a93a4Safresh1 ok($recursecoderef->("rec"), 'true in self-recursive anon sub'); 247256a93a4Safresh1} 248256a93a4Safresh1 249256a93a4Safresh1{ 250256a93a4Safresh1 use builtin qw( true false ); 251256a93a4Safresh1 252256a93a4Safresh1 my $val = true; 253256a93a4Safresh1 cmp_ok($val, $_, !!1, "true is equivalent to !!1 by $_") for qw( eq == ); 254256a93a4Safresh1 cmp_ok($val, $_, !0, "true is equivalent to !0 by $_") for qw( eq == ); 255256a93a4Safresh1 256256a93a4Safresh1 $val = false; 257256a93a4Safresh1 cmp_ok($val, $_, !!0, "false is equivalent to !!0 by $_") for qw( eq == ); 258256a93a4Safresh1 cmp_ok($val, $_, !1, "false is equivalent to !1 by $_") for qw( eq == ); 259256a93a4Safresh1} 260256a93a4Safresh1 261256a93a4Safresh1# indexed 262256a93a4Safresh1{ 263256a93a4Safresh1 use builtin qw( indexed ); 264256a93a4Safresh1 265256a93a4Safresh1 # We don't have Test::More's is_deeply here 266256a93a4Safresh1 267256a93a4Safresh1 ok(eq_array([indexed], [] ), 268256a93a4Safresh1 'indexed on empty list'); 269256a93a4Safresh1 270256a93a4Safresh1 ok(eq_array([indexed "A"], [0, "A"] ), 271256a93a4Safresh1 'indexed on singleton list'); 272256a93a4Safresh1 273256a93a4Safresh1 ok(eq_array([indexed "X" .. "Z"], [0, "X", 1, "Y", 2, "Z"] ), 274256a93a4Safresh1 'indexed on 3-item list'); 275256a93a4Safresh1 276256a93a4Safresh1 my @orig = (1..3); 277256a93a4Safresh1 $_++ for indexed @orig; 278256a93a4Safresh1 ok(eq_array(\@orig, [1 .. 3]), 'indexed copies values, does not alias'); 279256a93a4Safresh1 280256a93a4Safresh1 { 281256a93a4Safresh1 no warnings 'experimental::for_list'; 282256a93a4Safresh1 283256a93a4Safresh1 my $ok = 1; 284256a93a4Safresh1 foreach my ($len, $s) (indexed "", "x", "xx") { 285256a93a4Safresh1 length($s) == $len or undef $ok; 286256a93a4Safresh1 } 287256a93a4Safresh1 ok($ok, 'indexed operates nicely with multivar foreach'); 288256a93a4Safresh1 } 289256a93a4Safresh1 290256a93a4Safresh1 { 291256a93a4Safresh1 my %hash = indexed "a" .. "e"; 292256a93a4Safresh1 ok(eq_hash(\%hash, { 0 => "a", 1 => "b", 2 => "c", 3 => "d", 4 => "e" }), 293256a93a4Safresh1 'indexed can be used to create hashes'); 294256a93a4Safresh1 } 295256a93a4Safresh1 296256a93a4Safresh1 { 297256a93a4Safresh1 no warnings 'scalar'; 298256a93a4Safresh1 299256a93a4Safresh1 my $count = indexed 'i', 'ii', 'iii', 'iv'; 300256a93a4Safresh1 is($count, 8, 'indexed in scalar context yields size of list it would return'); 301256a93a4Safresh1 } 302256a93a4Safresh1} 303256a93a4Safresh1 304256a93a4Safresh1# Vanilla trim tests 305256a93a4Safresh1{ 306256a93a4Safresh1 use builtin qw( trim ); 307256a93a4Safresh1 308*f2a19305Safresh1 is(trim(" Hello world! ") , "Hello world!" , 'trim spaces'); 309*f2a19305Safresh1 is(trim("\tHello world!\t") , "Hello world!" , 'trim tabs'); 310*f2a19305Safresh1 is(trim("\n\n\nHello\nworld!\n") , "Hello\nworld!" , 'trim \n'); 311*f2a19305Safresh1 is(trim("\t\n\n\nHello world!\n \t"), "Hello world!" , 'trim all three'); 312*f2a19305Safresh1 is(trim("Perl") , "Perl" , 'trim nothing'); 313*f2a19305Safresh1 is(trim('') , "" , 'trim empty string'); 314*f2a19305Safresh1 315*f2a19305Safresh1 is(prototype(\&builtin::trim), '$', 'trim prototype'); 316256a93a4Safresh1} 317256a93a4Safresh1 318256a93a4Safresh1TODO: { 319256a93a4Safresh1 my $warn = ''; 320256a93a4Safresh1 local $SIG{__WARN__} = sub { $warn .= join "", @_; }; 321256a93a4Safresh1 322*f2a19305Safresh1 is(builtin::trim(undef), "", 'trim undef'); 323256a93a4Safresh1 like($warn , qr/^Use of uninitialized value in subroutine entry at/, 324*f2a19305Safresh1 'trim undef triggers warning'); 325256a93a4Safresh1 local $main::TODO = "Currently uses generic value for the name of non-opcode builtins"; 326256a93a4Safresh1 like($warn , qr/^Use of uninitialized value in trim at/, 327*f2a19305Safresh1 'trim undef triggers warning using actual name of builtin'); 328256a93a4Safresh1} 329256a93a4Safresh1 330256a93a4Safresh1# Fancier trim tests against a regexp and unicode 331256a93a4Safresh1{ 332256a93a4Safresh1 use builtin qw( trim ); 333256a93a4Safresh1 my $nbsp = chr utf8::unicode_to_native(0xA0); 334256a93a4Safresh1 335*f2a19305Safresh1 is(trim(" \N{U+2603} "), "\N{U+2603}", 'trim with unicode content'); 336256a93a4Safresh1 is(trim("\N{U+2029}foobar\x{2028} "), "foobar", 337*f2a19305Safresh1 'trim with unicode whitespace'); 338*f2a19305Safresh1 is(trim("$nbsp foobar$nbsp "), "foobar", 'trim with latin1 whitespace'); 339256a93a4Safresh1} 340256a93a4Safresh1 341256a93a4Safresh1# Test on a magical fetching variable 342256a93a4Safresh1{ 343256a93a4Safresh1 use builtin qw( trim ); 344256a93a4Safresh1 345256a93a4Safresh1 my $str3 = " Hello world!\t"; 346256a93a4Safresh1 $str3 =~ m/(.+Hello)/; 347*f2a19305Safresh1 is(trim($1), "Hello", "trim on a magical variable"); 348256a93a4Safresh1} 349256a93a4Safresh1 350256a93a4Safresh1# Inplace edit, my, our variables 351256a93a4Safresh1{ 352256a93a4Safresh1 use builtin qw( trim ); 353256a93a4Safresh1 354256a93a4Safresh1 my $str4 = "\t\tHello world!\n\n"; 355256a93a4Safresh1 $str4 = trim($str4); 356*f2a19305Safresh1 is($str4, "Hello world!", "trim on an inplace variable"); 357256a93a4Safresh1 358256a93a4Safresh1 our $str2 = "\t\nHello world!\t "; 359*f2a19305Safresh1 is(trim($str2), "Hello world!", "trim on an our \$var"); 360*f2a19305Safresh1} 361*f2a19305Safresh1 362*f2a19305Safresh1# is_tainted 363*f2a19305Safresh1{ 364*f2a19305Safresh1 use builtin qw( is_tainted ); 365*f2a19305Safresh1 366*f2a19305Safresh1 is(is_tainted($0), !!${^TAINT}, "\$0 is tainted (if tainting is supported)"); 367*f2a19305Safresh1 ok(!is_tainted($1), "\$1 isn't tainted"); 368*f2a19305Safresh1 369*f2a19305Safresh1 # Invokes magic 370*f2a19305Safresh1 tie my $tied, FetchStoreCounter => (\my $fetchcount, \my $storecount); 371*f2a19305Safresh1 372*f2a19305Safresh1 my $_dummy = is_tainted($tied); 373*f2a19305Safresh1 is($fetchcount, 1, 'is_tainted() invokes FETCH magic'); 374*f2a19305Safresh1 375*f2a19305Safresh1 $tied = is_tainted($0); 376*f2a19305Safresh1 is($storecount, 1, 'is_tainted() invokes STORE magic'); 377*f2a19305Safresh1 378*f2a19305Safresh1 is(prototype(\&builtin::is_tainted), '$', 'is_tainted prototype'); 379*f2a19305Safresh1} 380*f2a19305Safresh1 381*f2a19305Safresh1# Lexical export 382*f2a19305Safresh1{ 383*f2a19305Safresh1 my $name; 384*f2a19305Safresh1 BEGIN { 385*f2a19305Safresh1 use builtin qw( export_lexically ); 386*f2a19305Safresh1 387*f2a19305Safresh1 $name = "message"; 388*f2a19305Safresh1 export_lexically $name => sub { "Hello, world" }; 389*f2a19305Safresh1 } 390*f2a19305Safresh1 391*f2a19305Safresh1 is(message(), "Hello, world", 'Lexically exported sub is callable'); 392*f2a19305Safresh1 ok(!__PACKAGE__->can("message"), 'Exported sub is not visible via ->can'); 393*f2a19305Safresh1 394*f2a19305Safresh1 is($name, "message", '$name argument was not modified by export_lexically'); 395*f2a19305Safresh1 396*f2a19305Safresh1 our ( $scalar, @array, %hash ); 397*f2a19305Safresh1 BEGIN { 398*f2a19305Safresh1 use builtin qw( export_lexically ); 399*f2a19305Safresh1 400*f2a19305Safresh1 export_lexically 401*f2a19305Safresh1 '$SCALAR' => \$scalar, 402*f2a19305Safresh1 '@ARRAY' => \@array, 403*f2a19305Safresh1 '%HASH' => \%hash; 404*f2a19305Safresh1 } 405*f2a19305Safresh1 406*f2a19305Safresh1 $::scalar = "value"; 407*f2a19305Safresh1 is($SCALAR, "value", 'Lexically exported scalar is accessible'); 408*f2a19305Safresh1 409*f2a19305Safresh1 @::array = ('a' .. 'e'); 410*f2a19305Safresh1 is(scalar @ARRAY, 5, 'Lexically exported array is accessible'); 411*f2a19305Safresh1 412*f2a19305Safresh1 %::hash = (key => "val"); 413*f2a19305Safresh1 is($HASH{key}, "val", 'Lexically exported hash is accessible'); 414256a93a4Safresh1} 415256a93a4Safresh1 416256a93a4Safresh1# vim: tabstop=4 shiftwidth=4 expandtab autoindent softtabstop=4 417256a93a4Safresh1 418256a93a4Safresh1done_testing(); 419