I'm working on a program that does a call to GetTerminalSize() in Term::ReadKey. Usually the output goes to the terminal, but sometimes it may be redirected. Regardless of the case, I want to grab my terminal dimensions, including the pixel sizes. This is easily done by just looking at /dev/tty instead of STDOUT. However, Term::ReadKey doesn't work the way I would expect when trying to pass a filehandle to GetTerminalSize. From the documentation, I would think I could do this:
I'm working on a program that does a call to GetTerminalSize() in Term::ReadKey. Usually the output goes to the terminal, but sometimes it may be redirected. Regardless of the case, I want to grab my terminal dimensions, including the pixel sizes. This is easily done by just looking at /dev/tty instead of STDOUT. However, Term::ReadKey doesn't work the way I would expect when trying to pass a filehandle to GetTerminalSize. From the documentation, I would think I could do this:
But it doesn't work. Looking at the module, it's expecting the filehandle to be the 2nd argument to GetTerminalSize:
Shouldn't this be:
In order to get my program to work, I had to just pass a value (which looks to be ignored) before I pass the filehandle: