examples/error_prop
raw| 1 | #!/usr/local/bin/perl -w |
| 2 | |
| 3 | use Tk; |
| 4 | use Tk::ErrorDialog; |
| 5 | |
| 6 | # $SIG{__DIE__} = sub { print "die(",join(',',@_),")\n" }; |
| 7 | |
| 8 | sub one |
| 9 | { |
| 10 | shift->BackTrace("dying"); |
| 11 | } |
| 12 | |
| 13 | sub two |
| 14 | { |
| 15 | my $w = shift; |
| 16 | eval { one($w) }; |
| 17 | $w->BackTrace($@) if ($@); |
| 18 | } |
| 19 | |
| 20 | my $mw = MainWindow->new; |
| 21 | my $b = $mw->Button(-text => 'Moan', |
| 22 | -command => sub { after(1000, \&two, $mw) })->pack(-expand => 0); |
| 23 | MainLoop; |