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

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



On Wed, Apr 21, 2004 at 10:38:25AM +0200, Hilmar Preusse wrote:
> On 20.04.04 Julian Gilbey (jdg@polya.uklinux.net) wrote:
> 
> Hi Julian,
> 
> I'm just a perl beginner. Excuse me to ask questions.
> 
> > --- /tmp/texdoctk.orig	2004-04-20 22:10:43.000000000 +0100
> > +++ /tmp/texdoctk	2004-04-20 22:18:13.000000000 +0100
> > @@ -9,9 +7,20 @@
> >  # disclaimer.
> >  ###############################################################################
> >  use strict;
> > -use Tk;
> >  use Getopt::Long;
> >  Getopt::Long::config('bundling');
> > +use Tk;
> > 
> Isn't that use surplus, as the loading of the Tk-Module is done using
> "require" and "import"?

Duh!  Yes, of course it's surplus.  Please delete it.

> > +BEGIN {
> > +    eval { require Tk; import Tk; };
> > +    if ($@) {
> > +	my $progname = basename($0);
> > +	if ($@ =~ /^Can\'t locate Tk\.pm/) {
> > +	    die "$progname: you must have the perl-tk package installed\nto use this script\n";
> > +	} else {
> > +	    die "$progname: problem loading the Tk module:\n  $@\nHave you installed the perl-tk package?\n";
> > +	}
> > +    }
> > +}
> > 
> I see, that you're differing between two cases. However I don't see
> any sense in doing that, as it should be sufficient to evaluate the
> exit status of the require-import command, which is done before.
> What am I missing?

The first case is simply that it's not found, so the package is not
installed.  The latter is "something random went wrong".

> In general the solution sounds good, however I still prefer a
> message, which is visible even if texdoctk was started using the
> Debian-menu system.... just to prevent lame bug reports.

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?

   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: