How to get the Terminalsize with perl6/rakudo?
Question
Is there for perl6 already something to get the Terminalsize?
( for example like the perl5 "Term::ReadKey::GetTerminalSize" );
Solution
I'm not aware of a direct method, but parsing qx/resize/
should work on systems where the resize command is available.
Update: somewhat golfed parsing code:
my %h = qx/resize/.lines.grep(/\=/).map: { m/(\w+) \= (\d+) /; $/.list };
my ($y, $x) = %h<LINES COLUMNS>;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow