#!/usr/bin/perl # untested my $old = *{Tk::MainLoop}{CODE}; *Tk::MainLoop = sub { ... }; #Or use DoOneEvent() instead of MainLoop(), #to run only one event loop at a time. #An even better idea would be to look at #the test suite for Tk, and see how they handled it...