Skip to content

Commit d39fdcc

Browse files
committed
make perldl handle lack of Term::ReadKey gracefully
1 parent 7d2bf0f commit d39fdcc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/PDL/Doc/Perldl.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ our @EXPORT = qw( apropos aproposover usage help sig badinfo whatis );
4949
use PDL::Doc;
5050
use Pod::Select;
5151
use Pod::PlainText;
52-
use Term::ReadKey; #for GetTerminalSize
5352
use Cwd; # to help Debian packaging
5453

5554
$PDL::onlinedoc = PDL::Doc->new(FindStdFile());
@@ -73,8 +72,12 @@ sub FindStdFile {
7372
# to work (at least on my solaris and linux
7473
# machines)
7574
#
76-
sub screen_width() {
77-
return ( ( GetTerminalSize(\*STDOUT) )[0] // 72);
75+
sub screen_width {
76+
local $@;
77+
eval {
78+
require Term::ReadKey;
79+
( Term::ReadKey::GetTerminalSize(\*STDOUT) )[0];
80+
} // 72;
7881
}
7982

8083
sub printmatch {

0 commit comments

Comments
 (0)