I think part of the answer is to do error checking correctly like the faq entrySee my answer to previous poster -- that's a red herring as well as the unpack format.
What you are missing is:
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."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
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |