[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#200264: tetex's dependencies on texdoctk, dvipdfm, perl-tk



On Thu, Apr 22, 2004 at 10:03:58AM +0200, Frank K?ster wrote:
> The following patch works here. You forgot "use File::Basename;", it
> seems. It's in perl-modules, no problem with additional Dependencies.

Oops - was written in a rush and slightly untested.

One suggested fix below to distinguish the xmessage test in both cases
- please test!

> Regards, Frank
> 
> 
--- tetex-bin-2.0.2-CVS/texk/tetex/texdoctk.orig	Thu Apr 22 09:43:47 2004
+++ tetex-bin-2.0.2-CVS/texk/tetex/texdoctk	Thu Apr 22 09:59:54 2004
@@ -1,6 +1,4 @@
-#!/usr/bin/env perl
-# We started with a hack provided by Thomas Esser. This expression replaces
-# the unix specific line \type {#!/usr/local/bin/perl -w}.
+#!/usr/bin/perl
 ###############################################################################
 # texdoctk v.0.5.2 beta 4 (Feb 20, 2003) - GUI for TeX documentation access
 # Copyright (C) 2000-2002  Thomas Ruedas
@@ -9,9 +7,26 @@
 # disclaimer.
 ###############################################################################
 use strict;
-use Tk;
+use File::Basename;
 use Getopt::Long;
 Getopt::Long::config('bundling');
+
+BEGIN {
+    eval { require Tk; import Tk; };
+    if ($@) {
+	my $progname = basename($0);
+	my $message;
+	if ($@ =~ /^Can\'t locate Tk\.pm/) {
+	    $message = "$progname: you must have the perl-tk package installed\nto use this script\n";
+	} else {
+	    $message = "$progname: problem loading the Tk module:\n  $@\nHave you installed the perl-tk package?\n";
+	}
+
+	if (! -t STDOUT and exists $ENV{DISPLAY}
+	    and system("command -v xmessage >/dev/null 2>&1")==0) {
+	    exec("xmessage", $message);
+	} else {
+	    die $message;
+	}
+    }
+}
 
 my $IsWin32 = ($^O =~ /MSWin32/i);
 


   Julian

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        Julian Gilbey, website: http://www.polya.uklinux.net/
   Debian GNU/Linux Developer, see: http://people.debian.org/~jdg/
     Visit http://www.thehungersite.com/ to help feed the hungry



Reply to: