I’m seeing some occasional (one time in five), momentary (5-10 seconds) “freezing” when it drags—possibly as part of the -startcommand callback. It never happens on the first drag.
The callback is simple enough; it just sets the text of the dragging cursor to the value that is being dragged:
sub DragStart {
my( $token ) = @_;
my $w = $token->parent;
my $e = $w->XEvent;
my $idx = $w->nearest( $e->y );
if( defined $idx ) {
$token->configure( -text -> $w->get( $idx );
my( $X, $Y ) = ( $e->x, $e->y );
$token->MoveToplevelWindow( $X, $Y );
$token->raise;
$token->deiconify;
$token->FindSite( $X, $Y, $e );
}
}
I can’t help but wonder if the problem is outside of my code, so what I’d like to do is find a way to identify which subroutine is currently called when the freezing happens.
Is there such a tool? Something that shows a real-time call stack would do it, if there is one.
You should run your application through one of Perl’s debuggers.
Since you are a TK person, you could try Devel::ptkdb or you simply go for the standard Perl debugger.