Term::Size::ReadKey - Retrieve terminal size (via Term::ReadKey)
use Term::Size::ReadKey; ($columns, $rows) = Term::Size::ReadKey::chars *STDOUT{IO}; ($x, $y) = Term::Size::ReadKey::pixels;
Yet another implementation of Term::Size. Now using Term::ReadKey to do the hard work.
Term::Size
Term::ReadKey
($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 ommitted, *STDIN{IO} is used. In scalar context, it returns the terminal width.
chars
$h
*STDIN{IO}
($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 ommitted, *STDIN{IO} is used. In scalar context, it returns the terminal width.
pixels
Many systems with character-only terminals will return (0, 0).
(0, 0)
The basic test may fail harshly when running under the test harness. This happens with Term::ReadKey alone as well. Term::ReadKey gets away with murder by setting COLUMNS and LINES environment variables (which are used as a fallback). This release also applies the same cheat. I gotta find a more decent fix to these issues.
It all began with Term::Size by Tim Goodwin. You may want to have a look at:
Term::Size Term::Size::Unix Term::Size::Win32 Term::Size::Perl
You may as well be interested in what more Term::ReadKey does.
Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Term-Size-ReadKey
A. R. Ferreira, <ferreira@cpan.org>
Copyright (C) 2006-2008 by A. R. Ferreira
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Term::Size::ReadKey, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Term::Size::ReadKey
CPAN shell
perl -MCPAN -e shell install Term::Size::ReadKey
For more information on module installation, please visit the detailed CPAN module installation guide.