Bug#200264: tetex's dependencies on texdoctk, dvipdfm, perl-tk
Julian Gilbey <jdg@polya.uklinux.net> wrote:
> Something like:
>
> if (! -t STDOUT and exists $ENV{DISPLAY}
> and system("command -v xmessage >/dev/null 2>&1")==0) {
> exec("xmessage", "$progname: you must have the perl-tk package
> installed\nto use this script\n");
> } else {
> die "$progname: you must have the perl-tk package installed\nto use this script\n";
> }
>
> would do, perhaps?
The following patch works here. You forgot "use File::Basename;", it
seems. It's in perl-modules, no problem with additional Dependencies.
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);
+ if ($@ =~ /^Can\'t locate Tk\.pm/) {
+ if (! -t STDOUT and exists $ENV{DISPLAY}
+ and system("command -v xmessage >/dev/null 2>&1")==0) {
+ exec("xmessage", "$progname: you must have the perl-tk package installed\nto use this script\n");
+ } else {
+ die "$progname: you must have the perl-tk package installed\nto use this script\n\n";
+ }
+ } else {
+ die "$progname: problem loading the Tk module:\n $@\nHave you installed the perl-tk package?\n";
+ }
+ }
+}
my $IsWin32 = ($^O =~ /MSWin32/i);
--
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie
Reply to: