One of feature which has been requested a few times for the prove utility which ships with Test::Harness is the ability to run a test directly in the debugger. It would be nice to do this:

prove -d t/some_test.t

Admittedly, you can do some hacking in your code to include blib/lib and not use prove directly, but anyone who has had to do this often enough knows that this can sometimes mask bugs caused by the interaction of the test framework and the code being tested. Since we're working on the new version of Test::Harness, I decided to add this feature. Unfortunately, this failed because the code is unable to fetch the terminal size. I've managed to reduce the problem down to a one-liner:

perl -e '`perl -d -le "print 1"`'

This spits out:

Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): print 1 Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COL +UMNS and LINES environment variables didn't work. The resize program +didn't work. at /Library/Perl/5.8.6/darwin-thread-multi-2level/Term/R +eadKey.pm line 362. Compilation failed in require at /Library/Perl/5.8.6/Term/ReadLine/Per +l.pm line 63. at /Library/Perl/5.8.6/Term/ReadLine/Perl.pm line 63 Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x +1849f68)', 'GLOB(0x181100c)') called at /System/Library/Perl/5.8.6/pe +rl5db.pl line 6029 DB::setterm called at /System/Library/Perl/5.8.6/perl5db.pl li +ne 2203 DB::DB called at -e line 1 Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> q

As it turns out, there are other problems with adding the -d switch to prove (insecure $ENV{PATH} when using taint checking), but this appears to be the biggest obstacle. In order to meet our design goals, we'd like to solve this with the following constraints:

If those constraints cannot be met, we'll still consider making this an optional feature if this can be solved, but meeting the constraints would be wonderful. Help!

Cheers,
Ovid

New address of my CGI Course.


In reply to 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.