1#!./perl -w 2 3BEGIN { print "1..7\n"; } 4BEGIN { 5 print "not " if exists $^H{foo}; 6 print "ok 1 - \$^H{foo} doesn't exist initially\n"; 7} 8{ 9 # simulate a pragma -- don't forget HINT_LOCALIZE_HH 10 BEGIN { $^H |= 0x00020000; $^H{foo} = "a"; } 11 BEGIN { 12 print "not " if $^H{foo} ne "a"; 13 print "ok 2 - \$^H{foo} is now 'a'\n"; 14 } 15 { 16 BEGIN { $^H |= 0x00020000; $^H{foo} = "b"; } 17 BEGIN { 18 print "not " if $^H{foo} ne "b"; 19 print "ok 3 - \$^H{foo} is now 'b'\n"; 20 } 21 } 22 BEGIN { 23 print "not " if $^H{foo} ne "a"; 24 print "ok 4 - \$H^{foo} restored to 'a'\n"; 25 } 26 CHECK { 27 print "not " if exists $^H{foo}; 28 print "ok 6 - \$^H{foo} doesn't exist when compilation complete\n"; 29 } 30 print "not " if exists $^H{foo}; 31 print "ok 7 - \$^H{foo} doesn't exist at runtime\n"; 32} 33BEGIN { 34 print "not " if exists $^H{foo}; 35 print "ok 5 - \$^H{foo} doesn't exist while finishing compilation\n"; 36} 37