1# $OpenBSD: tk.pl,v 1.2 2001/01/29 01:58:48 niklas Exp $ 2 3# make sure every subprocess has it's exit and that the main one 4# hasn't 5sub fun { 6 unless ($pid = fork) { 7 unless (fork) { 8 use Tk; 9 $MW = MainWindow->new; 10 $hello = $MW->Button( 11 -text => 'Hello, world', 12 -command => sub {exit;}, 13 ); 14 $hello->pack; 15 MainLoop; 16 } 17 exit 0; 18 } 19 waitpid($pid, 0); 20} 21 221; 23