Addressing the cursor of a VT100 style terminal emulator using perl



I am working on a perl program which uses VT100 style escape codes and runs in gnome-terminal or konsole or rxterm or xterm or similar.

I want to know if there is a way to sent an escape sequence to the terminal emulator which queries for the current size of the screen and gets a report back. I am assuming that the user can resize the terminal. I plan to query the terminal size at the end of each pass. If the user resizes the terminal in the middle of pass - well - he's going to be confused.

Does anybody know how to do this? I have looked at Term::Cap but I don't see where that queries the current terminal size. Ditto for Term::ANSIColor.


Many thanks,


Jeff Silverman .