Ovid has asked for the wisdom of the Perl Monks concerning the following question:
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.tAdmittedly, 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:
- No non-core modules.
- Backwards compatible to at least 5.005 (earlier is better)
- Cross-platform
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Unable to get terminal size
by ikegami (Patriarch) on Sep 18, 2007 at 18:32 UTC | |
by tye (Sage) on Sep 18, 2007 at 21:07 UTC | |
by Ovid (Cardinal) on Sep 18, 2007 at 19:08 UTC | |
Re: Unable to get terminal size
by quester (Vicar) on Sep 19, 2007 at 07:08 UTC | |
Re: Unable to get terminal size
by danmcb (Monk) on Sep 20, 2007 at 08:40 UTC | |
by Ovid (Cardinal) on Sep 21, 2007 at 10:45 UTC |