I have been trying to debug a program Tkfor a while. It seems that the problem is related to a call deiconify()from a top-level window, however I cannot find the source file in which deiconify()sub is defined . Here is an example to illustrate what I mean:
test.pl
use strict;
use warnings;
use Tk;
my $mw = MainWindow->new( -title => "Main Window" );
$mw->Label(-text => "Debugging", -font => "Times 20")->pack( );
$mw->Button(
-text => 'Quit',
-command => sub { exit },
)->pack;
$mw->Button(
-text => 'Show window',
-command => \&show_window,
)->pack;
my $tl = $mw->Toplevel( -title => "Toplevel 1" );
$tl->Button(
-text => 'Quit',
-command => sub { exit },
)->pack;
$tl->withdraw();
MainLoop;
sub show_window {
$tl->deiconify();
$tl->raise();
}
First, I tried grep for subtitle 1 :
find . -name '*.pm' -exec grep -Hn deiconify {} \;find . -name '*.xs' -exec grep -Hn deiconify {} \;find . -name '*.al' -exec grep -Hn deiconify {} \;find . -name '*.h' -exec grep -Hn deiconify {} \;
Then I tried to run the script under the debugger
perl -d test.pl
and set a breakpoint just before the call $tl->deiconify()(see above). When I clicked sat a breakpoint
DB<1> s
Tk::Submethods::CODE(0x56245540c658)(/home/hakon/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/x86_64-linux/Tk/Submethods.pm:37):
37: *{$package.'::'.$sub} = sub { shift->$fn($sub,@_) };
, deiconify() ( 37 Tk::Submethods), s , 32 test.pl.
, Tk::wm - ( ), , ?
< > 1. Tk. , :
cpan -g Tk
tar zxvf Tk-804.033.tar.gz
cd Tk-804.033
>