1Term::Size::Any(3) User Contributed Perl Documentation Term::Size::Any(3)
2
3
4
6 Term::Size::Any - Retrieve terminal size
7
9 # the traditional way
10 use Term::Size::Any qw( chars pixels );
11
12 ($columns, $rows) = chars *STDOUT{IO};
13 ($x, $y) = pixels;
14
16 This is a unified interface to retrieve terminal size. It loads one
17 module of a list of known alternatives, each implementing some way to
18 get the desired terminal information. This loaded module will actually
19 do the job on behalf of "Term::Size::Any".
20
21 Thus, "Term::Size::Any" depends on the availability of one of these
22 modules:
23
24 Term::Size (soon to be supported)
25 Term::Size::Perl
26 Term::Size::ReadKey (soon to be supported)
27 Term::Size::Win32
28
29 This release fallbacks to Term::Size::Win32 if running in Windows 32
30 systems. For other platforms, it uses the first of Term::Size::Perl,
31 Term::Size or Term::Size::ReadKey which loads successfully. (To be
32 honest, I disabled the fallback to Term::Size and Term::Size::ReadKey
33 which are buggy by now.)
34
35 FUNCTIONS
36 The traditional interface is by importing functions "chars" and
37 "pixels" into the caller's space.
38
39 chars
40 ($columns, $rows) = chars($h);
41 $columns = chars($h);
42
43 "chars" returns the terminal size in units of characters
44 corresponding to the given filehandle $h. If the argument is
45 omitted, *STDIN{IO} is used. In scalar context, it returns the
46 terminal width.
47
48 pixels
49 ($x, $y) = pixels($h);
50 $x = pixels($h);
51
52 "pixels" returns the terminal size in units of pixels corresponding
53 to the given filehandle $h. If the argument is omitted, *STDIN{IO}
54 is used. In scalar context, it returns the terminal width.
55
56 Many systems with character-only terminals will return "(0, 0)".
57
59 It all began with Term::Size by Tim Goodwin. You may want to have a
60 look at:
61
62 Term::Size
63 Term::Size::Perl
64 Term::Size::Win32
65 Term::Size::ReadKey
66
68 Please reports bugs via CPAN RT, via web
69 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Term-Size-Any or e-mail to
70 bug-Term-Size-Any@rt.cpan.org.
71
73 Adriano R. Ferreira, <ferreira@cpan.org>
74
76 Copyright (C) 2008-2012 by Adriano R. Ferreira
77
78 This library is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.
80
81
82
83perl v5.30.1 2020-01-30 Term::Size::Any(3)