From 978e1bcfe237cc9d623bc244423afc40de5e920e Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Thu, 2 Jan 2025 13:54:31 +0800 Subject: [PATCH] clear: handling OSPEED is not needed (#894) * The OSPEED option being passed to Tgetent() is not required for clearing the screen * Win32 perl might not have a working Term::Cap, so move the Tgetent() call into the eval just in case * Tested on Linux and OpenBSD --- bin/clear | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/bin/clear b/bin/clear index c86aff95..a66754fa 100755 --- a/bin/clear +++ b/bin/clear @@ -11,21 +11,13 @@ License: perl =cut - -use Term::Cap; use strict; -my $OSPEED = 9600; -eval { - require POSIX; - my $termios = POSIX::Termios->new(); - $termios->getattr; - $OSPEED = $termios->getospeed; -}; +use Term::Cap; -my $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED}); my $cl = ""; eval { + my $terminal = Term::Cap->Tgetent; $terminal->Trequire("cl"); $cl = $terminal->Tputs('cl', 1); };