in reply to Re^2: Failing to get current TTY's rows & columns...
in thread Failing to get current TTY's rows & columns...
I don't have linux, but no, I don't think that is the answer.
I think part of the answer is to do error checking correctly like the faq entry
I also think using S4 is part of the answer, not being an expert on pack/unpack and not having a /dev/tty, I can't run any tests.
Hmmm....I'm disappointed that I need to open another file handle and can't get the rows & columns associated with my already open FH, "STDOUT", directly...
Sounds premature if you ask me, avoiding abstractions always involves some growing pains :)
Shouldn't STDIN, STDOUT map to fd[0], fd[1] => /dev/pts/1 on some level?
They do
See, fd 0,1,2. Now regarding tty, using operator -t to test if filehandle is opened to a tty, you can see 0,1,2 are connected to a tty$ perl -le " print fileno($_) for STDIN, STDOUT, STDERR " 0 1 2
but not when you do redirection, here is STDIN not connected to a tty$ perl -le " print 0+-t $_ for STDIN, STDOUT, STDERR " 1 1 1
here is STDIN and STDERR not connected to a tty$ perl -le " print 0+-t $_ for STDIN, STDOUT, STDERR " < NUL 0 1 1
here is STDOUT not connected to a tty$ perl -le " print 0+-t $_ for STDIN, STDOUT, STDERR " < NUL 2> NUL 0 1 0
I.e. Shouldn't I be able to use some mapping function on STDOUT to get a file descriptor that's suitable for ioctl?$ perl -le " print 0+-t $_ for STDIN, STDOUT, STDERR " > out.txt $ cat out.txt 1 0 1
ioctl says you don't need to, the faq item doesn't, and neither does Term::Size::Any
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Failing to get current TTY's rows & columns...
by perl-diddler (Chaplain) on Apr 15, 2011 at 22:08 UTC | |
by Anonymous Monk on Apr 15, 2011 at 22:29 UTC | |
by perl-diddler (Chaplain) on Apr 16, 2011 at 04:58 UTC | |
by tchrist (Pilgrim) on Apr 17, 2011 at 05:13 UTC |