When I output tput clear | hexdump -c I get different results if I'm on kitty or xterm. How can I use Term::Cap to generate these terminal signals on the respective terminal?
What I've tried is a direct-copy-paste from the docs with setup,
use strict;
use warnings;
use Term::Cap;
use POSIX;
my $termios = new POSIX::Termios;
$termios->getattr;
my $ospeed = $termios->getospeed;
my $terminal = Tgetent Term::Cap { TERM => undef, OSPEED => $ospeed };
And then I thought this should work,
$terminal->Tputs('clear', 1, *STDOUT );
But alas, it does nothing.
If I provide a different non-existent name for the term (rather than undef which defaults to $ENV{TERM}, I get)
Can't find a valid termcap file at ./test.pl line 9.
So I know it's looking up the termcap file, and finding it.
Right way
All of termcap's signal names are two letters. For clear you'll want
clYou can find the full list on
man termcap, which has a full list:Thanks to Thomas Dickey for the answer in comments
Wrong way
Not sure what I was doing wrong, as a temporary work around I did
This still has a spin up another process, but it worked fine. I won't accept this answer in the event anyone knows how to do this the right way.