[Po4a-commits] po4a/lib/Locale/Po4a Common.pm,1.6,1.7

Martin Quinson po4a-devel@lists.alioth.debian.org
Mon, 21 Mar 2005 10:12:04 +0000


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv24725/lib/Locale/Po4a

Modified Files:
	Common.pm 
Log Message:
catch Term::ReadKey::GetTerminalSize failures so that we can build on the terminal-less settings that some debian automated builder love

Index: Common.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Common.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Common.pm	3 Mar 2005 16:04:40 -0000	1.6
+++ Common.pm	21 Mar 2005 10:11:59 -0000	1.7
@@ -31,12 +31,18 @@
 use warnings;
 use Locale::gettext;
 use Text::WrapI18N qw(wrap $columns);
-use Term::ReadKey qw(GetTerminalSize);
+use Term::ReadKey;
 
 sub setcolumns {
     my ($col,$h,$cp,$hp);
-    ($col,$h,$cp,$hp) = GetTerminalSize();
-    $columns = $ENV{'COLUMNS'} || $col || 80;
+    eval {
+	($col,$h,$cp,$hp) = Term::ReadKey::GetTerminalSize(); 
+    };
+    if ($@) {
+       # GetTerminalSize failed. Maybe a terminal-less build or such strange condition. Let's play safe.
+       $col = 76;
+    }
+    $columns = $ENV{'COLUMNS'} || $col || 76;
 #    print "set col to $columns\n";
 }