Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
perlで画面にテキストを出力しています
ただし、各画面行に1行だけが収まるようにしたいので、画面を変更すると、プログラムは出力行サイズを自動的に調整します。
ユーザーの操作なしで自動的にそれを行う方法はありますか?
ありがとう
Unix / Linuxでは、Termファミリのモジュールを使用して、現在の画面サイズを取得できるはずです。SIGWINCHをフックして、出力を調整することでターミナルウィンドウのサイズ変更イベントに応答することもできます。
http://search.cpan.org/modlist/User_Interfaces/Term
perl -MTerm::ReadKey -E '($cols,$rows) = GetTerminalSize(); say "This screen has $rows rows and $cols columns."'