Perl(3pm)
π Term::Size::Perl β the manual, but make it a group chat π
okay bestie, this is the user-contributed Perl documentation for Perl(3pm), a.k.a. Term::Size::Perl π β the Perl extension for retrieving terminal size (Perl version). yes it's a mouthful, yes it's iconic, let's go β¨
What is this even β Term::Size::Perl β a Perl extension for retrieving terminal size, Perl version. that's the whole vibe π¦
β¨ SYNOPSIS β¨
like, just look at it, it's so clean ππ
use Term::Size::Perl;
($columns, $rows) = Term::Size::Perl::chars *STDOUT{IO};
($x, $y) = Term::Size::Perl::pixels;
πΈ DESCRIPTION πΈ
okay so. this is yet another implementation of Term::Size π β and the glow-up is that it's now in pure Perl, with the one (1) exception of a C probe that gets run at build time. lowkey iconic behavior fr fr π§
π« FUNCTIONS π«
π«Ά chars
($columns, $rows) = chars($h);
$columns = chars($h);
chars hands you the terminal size in units of characters, and it does it for whatever filehandle $h you're pointing at π
if you straight up don't pass an argument? no worries, bestie, it falls back to *STDIN{IO} π
and in scalar context it gives you just the terminal width. no cap πβ¨
π¦ pixels
($x, $y) = pixels($h);
$x = pixels($h);
pixels</purl> β wait, pixels β returns the terminal size in units of pixels for the given filehandle $h π
argument omitted? again, *STDIN{IO} steps in like the main character it is π
scalar context β terminal width only. same energy as chars, different unit β
β οΈ heads up though: on many systems with character-only terminals, this is gonna return "(0, 0)" π not a bug, just the vibe of that hardware. don't come for me.
π₯ SEE ALSO π₯
the origin story!!! it all began with Term::Size by Tim Goodwin ππ«Ά you may want to have a lil look at:
Term::SizeTerm::Size::Win32Term::Size::ReadKey
π£ bugs β please report them via GitHub, over at <https://github.com/aferreira/cpan-Term-Size-Perl/issues> ππ
and pro tip, when you're reporting bugs, it may be helpful to attach the Params.pm that the probe generates at build time π (iykyk)
π AUTHOR π
Adirano Ferreira, <ferreira@cpan.org> β thank u king π«‘β¨
π COPYRIGHT AND LICENSE π
Copyright (C) 2006-2007, 2017-2018 by Adriano Ferreira
this library is free software ποΈ you can redistribute it and/or modify it under the same terms as Perl itself. slay, legally speaking π π
and that's the whole page, bestie!! this was perl v5.42.3, dated 2026-08-19, filed under Perl(3pm) β go get those terminal dimensions, u got this ππβ¨
π¦ where this page comes from
- ubuntu stonking: libterm-size-perl-perl 0.031-2build7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms