{ package A; local *x = sub { die "aaa" }; #run tests ... } # &x reset after leaving block