Subject: | [patch] Term::Readkey, GetTerminalSize dies on failure |
Hi,
Attached is a patch used in the Debian package of Term::ReadKey that
brings the code in accordance to the documentation.
the documentation of the GetTerminalSize function reads:
Returns either an empty array if this operation is unsupported, or a
four element array containing[...]
The code, however simply dies, instead of returning an empty array.
For reference, the Debian bug report is at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=300711
Thanks in advance,
dam
Subject: | GetTermSize-as-documented-300711.patch |
# Modify the GetTerminalSize function to match its documented behaviour
--- libterm-readkey-perl-2.30.orig/ReadKey.pm
+++ libterm-readkey-perl-2.30/ReadKey.pm
@@ -357,10 +357,11 @@
push( @fail, "resize program" );
}
- if ( @results < 4 )
+ if ( @results != 4 )
{
- die "Unable to get Terminal Size."
+ warn "Unable to get Terminal Size."
. join( "", map( " The $_ didn't work.", @fail ) );
+ return undef;
}
@results;