cmac has asked for the wisdom of the Perl Monks concerning the following question:

I added a -d to the initial (bang) line of a program that's years old, to see why it worked funny recently. Here's what happened:
------------------------------------------- dual-1-25:/Documents/Ours/logs/bin $ ./list_db_all>../to_excel/exc1081 +103.txt 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::(./list_db_all:56): our $bigpack = 'dI'.FIXED_CTS.'d'.CELLS_P +ER; 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 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/Te +rm/ReadKey.pm line 362. Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.8/ +Term/ReadLine/Perl.pm line 63. at /usr/local/lib/perl5/site_perl/5.8.8/Term/ReadLine/Perl.pm line 63 Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x848b +b8)', 'GLOB(0x83d20c)') called at /usr/local/lib/perl5/5.8.8/perl5db. +pl line 6029 DB::setterm called at /usr/local/lib/perl5/5.8.8/perl5db.pl line 2 +203 DB::DB called at ./list_db_all line 56 Debugged program terminated. Use q to quit or R to restart, ------------------------------------------
This is with 5.8.8 under Mac OS X -- the most current Leopard. Sent the file up to my server (also 5.8.8 but FreeBSD): no such problems. Put a -d into a related program on my home (OS X) machine, and it starts up cleanly. Tried "zapping gremlins" (non-printable characters) in BBEdit: no help.

Do you think something has gotten corrupted? I revitalized my CPAN collection last night with an 'upgrade': lots of output and fury (and an upgrade of Term::ReadLine from the 5.8.6 directory to 5.8.8) but no help for this problem.

How would you attack this problem?

Thanks, cmac

Replies are listed 'Best First'.
Re: debug startup problem
by massa (Hermit) on Nov 19, 2008 at 18:36 UTC

    How would you attack this problem?

    By eliminating the redirect, for starters? ReadLine is complaining that your terminal is not a terminal... Also try chaning Term::ReadLine for Term::ReadLine::Gnu or something like it...

    []s, HTH, Massa (κς,πμ,πλ)
      I am not using readLine in my program. It is brought in by the Perl debugger due to the -d that I recently added to the first line. Is there any way for me to have control over the aspects that you suggest, in this case?
        From another forum I have learned that perldb requires STDOUT to be a terminal, so that the ">../to_excel/excnnnnn.txt" in my invocation line caused my problem. This would not have to be the case: the writer on the site where I learned about this feature noted that perldb could find the terminal from any of STDIN, STDOUT, or STDERR, whichever was not redirected.

        SUGGESTION FOR FUTURE WORK ON perldb!!

        As it is, I will revise the program to open and use the output file named in ARGV[0], and leave my command line unchanged except for replacing '>' with a space.
        I think but can't test right now that if you put -MTerm::ReadLine::Gnu before the -d the perl debugger will use that... obviously, you may have to install Term::ReadLine::Gnu first!
        []s, HTH, Massa (κς,πμ,πλ)