Skip to content

Commit

Permalink
clear: handling OSPEED is not needed (#894)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mknos authored Jan 2, 2025
1 parent 3f30c25 commit 978e1bc
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions bin/clear
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 978e1bc

Please sign in to comment.