Last Review: Nov-26-2010
When running Perl > 5.8x (i.e. Perl 5.10) on Linux Boxes you can meet a problem running programs which use the Perl/Tk 804.028 toolkit: While everything seems to be properly installed, Perl/Tk based programs will only briefly flash a GUI window before crashing down.
Although on several net places it is claimed, that CPAN's Perl/Tk 804.028 module download has been already patched, I could'nt realise any change until now (January 2010). Thanks the OSS nature of this great piece of software we have chances to help ourselves! Just a few minutes work and you can take off again...
# Make the target directory to our working directory, so we can
# see, if it exits, without doing anything else:
#
cd /usr/local/lib/perl/5.10.0/Tk/
#
# Now we open the target file as root:
#
sudo YourFavoriteEdior Widget.pm
sub MouseWheelBind
{
my($mw,$class) = @_;
# The MouseWheel will typically only fire on Windows. However, one
# could use the "event generate" command to produce MouseWheel
# events on other platforms.
# $mw->Tk::bind($class, '<MouseWheel>',
# [ sub { $_[0]->yview('scroll',-($_[1]/120)*3,'units') }, Tk::Ev("D")]);
if ($Tk::platform eq 'unix')
{
# Support for mousewheels on Linux/Unix commonly comes through mapping
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
# http://www.inria.fr/koala/colas/mouse-wheel-scroll/
$mw->Tk::bind($class, '<4>',
sub { $_[0]->yview('scroll', -3, 'units')
unless $Tk::strictMotif;
});
$mw->Tk::bind($class, '<5>',
sub { $_[0]->yview('scroll', 3, 'units')
unless $Tk::strictMotif;
})
}
}