I think part of the answer is to do error checking correctly like the faq entry
See my answer to previous poster -- that's a red herring as well as the unpack format.

What you are missing is:

"I.e. Shouldn't I be able to use some mapping function on STDOUT to get a file descriptor that's suitable for ioctl?
ioctl says you don't need to, the faq item doesn't, and neither does Term::Size::Any
The faq item doesn't use STDOUT. It doesn't show how one would use STDOUT to determine the terminal's size. It opens '/dev/tty' -- ANOTHER file handle -- it doesn't show how to determine the size of the terminal attached to STDOUT.

Of note -- if STDOUT was redirected to a file, then trying to determine its size woudn't return valid values (presumably the ioctl would return an error).

So how would you determine the rows/columns of whatever STDOUT is pointing to (without opening another character device like "/dev/tty")?

Even if you aren't on linux, presumably there's a way to do it on your platform, no? I.e. if you have a 'tty' window, how would you determine the size of the window addressed by 'STDOUT'?


In reply to Re^4: Failing to get current TTY's rows & columns... by perl-diddler
in thread Failing to get current TTY's rows & columns... by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.