1Perl(3) User Contributed Perl Documentation Perl(3)
2
3
4
6 Term::Size::Perl - Perl extension for retrieving terminal size (Perl
7 version)
8
10 use Term::Size::Perl;
11
12 ($columns, $rows) = Term::Size::Perl::chars *STDOUT{IO};
13 ($x, $y) = Term::Size::Perl::pixels;
14
16 Yet another implementation of "Term::Size". Now in pure Perl, with the
17 exception of a C probe run on build time.
18
19 FUNCTIONS
20 chars
21 ($columns, $rows) = chars($h);
22 $columns = chars($h);
23
24 "chars" returns the terminal size in units of characters
25 corresponding to the given filehandle $h. If the argument is
26 ommitted, *STDIN{IO} is used. In scalar context, it returns the
27 terminal width.
28
29 pixels
30 ($x, $y) = pixels($h);
31 $x = pixels($h);
32
33 "pixels" returns the terminal size in units of pixels corresponding
34 to the given filehandle $h. If the argument is ommitted,
35 *STDIN{IO} is used. In scalar context, it returns the terminal
36 width.
37
38 Many systems with character-only terminals will return "(0, 0)".
39
41 It all began with Term::Size by Tim Goodwin. You may want to have a
42 look at:
43
44 Term::Size
45 Term::Size::Unix
46 Term::Size::Win32
47 Term::Size::ReadKey
48
49 It would be helpful if you send me the Params.pm generated by the probe
50 at build time. Please reports bugs via CPAN RT,
51 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Term-Size-Perl
52
54 I am having some hard time to make tests run correctly under the "cpan"
55 script. Some Unix systems do not seem to provide a working tty inside
56 automatic installers. I think it needs some skip tests, but I am yet
57 not sure what should be the portable tests for this.
58
59 Update: This distribution uses new tests to skip if filehandle is not a
60 tty. It was noticed that "Test::Harness" and "prove", for instance,
61 provide a non-tty STDOUT to the test script and automatic installers
62 could provide a non-tty STDIN. So the former tests were basically
63 wrong. I am improving my understanding of the involved issues and I
64 hope to soon fix the tests for all of Term::Size modules.
65
67 A. R. Ferreira, <ferreira@cpan.org>
68
70 Copyright (C) 2006-2007 by A. R. Ferreira
71
72 This library is free software; you can redistribute it and/or modify it
73 under the same terms as Perl itself.
74
75
76
77perl v5.12.0 2007-03-11 Perl(3)