It looks to me like "perl -d" has a terminal in the above scenario. And, no, "perl -d" does not expect/require that STDIN nor STDOUT be terminals. The default Perl debugger opens its own handles for input and output to "the terminal" (by opening "/dev/tty" or "con:" or such) which means it doesn't mind if at least some of STDIN, STDOUT, and STDERR are redirected. My guess is that "/dev/tty" doesn't "work" when all three of those handles are redirected while "con:" works even if all three are redirected. In the above example, it appears to me that STDIN is still connected to the tty (as is STDERR but not STDOUT).

It is unfortunate that Term::ReadKey::GetTerminalSize() destroys any evidence about why most of the listed attempts failed. Doing a little debugging of the debugger's start-up in order to recover exactly why each of the attempts failed seems the obvious next step. An easy way to do that is simply to edit ReadKey.pm to correct its silence.

It looks to me like this is a bug in the Perl debugger that wasn't there last time I worked on it. I certainly noticed this type of complaint a lot after some upgrade (likely perl 5.6 or 5.6.1) and have succeeded in mostly ignoring it.

My testing of the example invocation on a Unix system shows that, despite all of the code to the contrary, GetTerminalSize() is trying to get the terminal size of STDOUT (which isn't a terminal).

The crux of the problem is that $readline::term_OUT isn't being set to $DB::OUT despite $IN and $OUT being passed in $term = new Term::ReadLine 'perldb', $IN, $OUT;

- tye        


In reply to Re^2: Unable to get terminal size (tty) by tye
in thread Unable to get terminal size by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.