1N/Apackage test;
# test from somewhere other than main 1N/A# create and destroy some automatic Safe compartments first 1N/A print ${$cpt->varglob('foo')} == 42 ? "ok $t\n" : "not ok $t\n"; $t++; 1N/A print $foo == 9 ? "ok $t\n" : "not ok $t\n"; $t++; 1N/A print $cpt->reval('$foo') == 9 ? "ok $t\n" : "not ok $t\n"; $t++; 1N/A # check 'main' has been changed: 1N/A print $cpt->reval('$::foo') == 9 ? "ok $t\n" : "not ok $t\n"; $t++; 1N/A print $cpt->reval('$main::foo') == 9 ? "ok $t\n" : "not ok $t\n"; $t++; 1N/A # check we can't see our test package: 1N/A print $cpt->reval('$test::foo') ? "not ok $t\n" : "ok $t\n"; $t++; 1N/A print $cpt->reval('${"test::foo"}') ? "not ok $t\n" : "ok $t\n"; $t++; 1N/A print $cpt->reval('$foo') ? "not ok $t\n" : "ok $t\n"; $t++; 1N/A # Note that we *must* use $cpt->varglob here because if we used 1N/A # $Root::foo etc we would still see the original values! 1N/A # This seems to be because the compiler has created an extra ref.