1#!./perl 2 3print "1..14\n"; 4 5$blurfl = 123; 6$foo = 3; 7 8package xyz; 9 10sub new {bless [];} 11 12$bar = 4; 13 14{ 15 package ABC; 16 $blurfl = 5; 17 $main'a = $'b; 18} 19 20$ABC'dyick = 6; 21 22$xyz = 2; 23 24$main = join(':', sort(keys %main::)); 25$xyz = join(':', sort(keys %xyz::)); 26$ABC = join(':', sort(keys %ABC::)); 27 28if ('a' lt 'A') { 29 print $xyz eq 'bar:main:new:xyz:ABC' ? "ok 1\n" : "not ok 1 '$xyz'\n"; 30} else { 31 print $xyz eq 'ABC:bar:main:new:xyz' ? "ok 1\n" : "not ok 1 '$xyz'\n"; 32} 33print $ABC eq 'blurfl:dyick' ? "ok 2\n" : "not ok 2 '$ABC'\n"; 34print $main'blurfl == 123 ? "ok 3\n" : "not ok 3\n"; 35 36package ABC; 37 38print $blurfl == 5 ? "ok 4\n" : "not ok 4\n"; 39eval 'print $blurfl == 5 ? "ok 5\n" : "not ok 5\n";'; 40eval 'package main; print $blurfl == 123 ? "ok 6\n" : "not ok 6\n";'; 41print $blurfl == 5 ? "ok 7\n" : "not ok 7\n"; 42 43package main; 44 45sub c { caller(0) } 46 47sub foo { 48 my $s = shift; 49 if ($s) { 50 package PQR; 51 main::c(); 52 } 53} 54 55print((foo(1))[0] eq 'PQR' ? "ok 8\n" : "not ok 8\n"); 56 57my $Q = xyz->new(); 58undef %xyz::; 59eval { $a = *xyz::new{PACKAGE}; }; 60print $a eq "__ANON__" ? "ok 9\n" : "not ok 9 # '$a'\n"; 61 62eval { $Q->param; }; 63print $@ =~ /^Can't use anonymous symbol table for method lookup/ ? 64 "ok 10\n" : "not ok 10 # '$@'\n"; 65 66print "$Q" =~ /^__ANON__=/ ? "ok 11\n" : "not ok 11 # '$Q'\n"; 67 68print ref $Q eq "__ANON__" ? "ok 12\n" : "not ok 12 # '$Q'\n"; 69 70package bug32562; 71 72print __PACKAGE__ eq 'bug32562' ? "ok 13\n" : "not ok 13\n"; 73print eval '__PACKAGE__' eq 'bug32562' ? "ok 14\n" : "not ok 14\n"; 74