quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] Term::ReadKey in test/run


From: Jean Delvare
Subject: Re: [Quilt-dev] Term::ReadKey in test/run
Date: Tue, 6 Sep 2005 11:22:02 +0200 (CEST)

Hi John,

[John Vandenberg]
> Could the following patch be applied to allow test/run to work without
> Term::ReadKey?  It isnt installed by default on several unix/linux
> favours I have run into, and I haven't found a way to compile it into
> MSYS perl.

I didn't realize that Term::ReadKey was solely used to get the number of
columns the terminal has. Sounds a bit overkill to me, especially since
this module isn't part of the standard distribution.

> Index: quilt/test/run
> ===================================================================
> --- quilt.orig/test/run
> +++ quilt/test/run
> @@ -13,11 +13,25 @@ use strict;
>  use FileHandle;
>  use Getopt::Std;
>  use POSIX qw(isatty setuid);
> -use Term::ReadKey;
>  use vars qw($opt_l $opt_v);
>
> +BEGIN {
> +  my $mod = 'Term::ReadKey';
> +  if (eval "require $mod") {
> +    $mod->import();
> +  }
> +  else {
> +    eval 'sub GetTerminalSize() {
> +      my @rv;
> +      push @rv, $ENV{COLUMNS} || 80;
> +      return @rv;
> +    }';

Can be simplified to:
eval 'sub GetTerminalSize() {
      return ($ENV{COLUMNS} || 80);
}';

> +  }
> +}
> +
>   no warnings qw(taint);

Anyway, I would go with ($ENV{COLUMNS} || 80) for everyone without even
trying Term::ReadKey. This should be sufficient, it's only a test suite
after all.

Oh, and thanks for the trick, now I can use the test suite here :)

Thanks,
--
Jean Delvare




reply via email to

[Prev in Thread] Current Thread [Next in Thread]