# the traditional way use Term::Size::Any qw( chars pixels ); ($columns, $rows) = chars *STDOUT{IO}; ($x, $y) = pixels;
Thus, "Term::Size::Any" depends on the availability of one of these modules:
Term::Size (soon to be supported) Term::Size::Perl Term::Size::ReadKey (soon to be supported) Term::Size::Win32
This release fallbacks to Term::Size::Win32 if running in Windows 32 systems. For other platforms, it uses the first of Term::Size::Perl, Term::Size or Term::Size::ReadKey which loads successfully. (To be honest, I disabled the fallback to Term::Size and Term::Size::ReadKey which are buggy by now.)
($columns, $rows) = chars($h); $columns = chars($h);
"chars" returns the terminal size in units of characters corresponding to the given filehandle $h. If the argument is omitted, *STDIN{IO} is used. In scalar context, it returns the terminal width.
($x, $y) = pixels($h); $x = pixels($h);
"pixels" returns the terminal size in units of pixels corresponding to the given filehandle $h. If the argument is omitted, *STDIN{IO} is used. In scalar context, it returns the terminal width.
Many systems with character-only terminals will return "(0, 0)".
Term::Size Term::Size::Perl Term::Size::Win32 Term::Size::ReadKey
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.