James Edward Gray II wrote: > On Dec 15, 2003, at 10:51 AM, Charles K. Clarkson wrote: > > > James Edward Gray II <[EMAIL PROTECTED]> wrote: > > > > > > So my question is, is there a "Pure Perl" way to fetch > > > the terminal columns and rows? > > > > > > I took a look at the source of Term::ReadKey and it > > seemed to be pure perl. Are you sure it's not? > > Haven't got a clue, to tell the truth! <laughs> > > I assumed it was not, for two reasons. One, the POD says, > "Term::ReadKey is a compiled perl module..." and that ugly compiled > word in there scared me. And two, I can't see where the > function calls > at the beginning of GetTerminalSize() are coming from > (termsizeoptions(), GetTermSizeVIO(), GetTermSizeGWINSZ(), > GetTermSizeGSIZE(), GetTermSizeWin32()). > > I also just had the thought to go check the CPAN's listing. It said > 'Rdcf?' under the DSLIP column. I'm pretty sure that middle 'c' in > there means it's written in C and Perl. I know how dangerous > assumptions are though, especially mine, and I won't be surprised if > I'm wrong.
You're right, it's not a pure perl module. The "bootstrap" statement around line 240 gives it away as well. > > > If it is, you could use it as a guide to write your own sub. Or, > > if you're allowed to install multiple files, you could > > include this module in your package. > > I did try to look at the module, but as you can see, I can't > tell what > it's doing. It's trying to make the process platform-independent, which is rather tricky. You might be able to get away with something as simple as querying the LINES and COLUMNS environment variables. Or use the output from 'tput lines' and 'tput columns'. It all depends on your platform... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>