Package: texlive-base / 2018.20190227-2

texdoctk-warn-missing-perltk Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
 texmf-dist/scripts/texdoctk/texdoctk.pl |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

--- texlive-base-2017.20170724.orig/texmf-dist/scripts/texdoctk/texdoctk.pl
+++ texlive-base-2017.20170724/texmf-dist/scripts/texdoctk/texdoctk.pl
@@ -12,7 +12,6 @@
 ###############################################################################
 my ($version, $date) = ("0.6.1", "2012-12-23");
 use strict;
-use Tk;
 use Getopt::Long;
 Getopt::Long::config('bundling');
 use File::Basename;
@@ -30,6 +29,20 @@
 #  ));
 }
 
+eval { require Tk; };
+if ($@) {
+  if (-x "/usr/bin/xmessage") {
+    `xmessage -center -buttons Quit "The program texdoctk needs the package perl-tk, please install it!"`;
+  } else {
+    printf STDERR "The program texdoctk needs the package perl-tk, please install it!\n";
+  }
+  exit(1);
+  # that didn't work out, so warn the user and continue with text mode
+} else {
+  Tk->import;
+}
+
+
 # initialization of some internal variables
 $|=1;
 my $quiet=1;
@@ -255,7 +268,7 @@
 for ($i=0,$j=5; $i<@catg; ++$i,++$j) {
     $tlwins{'mainwindow'}{'buttons'}[$j]=$catg[$i];
 }
-MainLoop;
+MainLoop();
 
 ########## SUBROUTINES ########################################################
 # toplevel for selecting a topic of a category for viewing or printing
@@ -1754,7 +1767,7 @@
 				-width=>$msgwidth)->pack(-side=>'top');
     $message->insert('end',$msg);
     $message->configure(-state=>'disabled');
-    MainLoop;
+    MainLoop();
 }
 
 if ($IsWin32) {