Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Problem Running Perl Debugger

by roho (Canon)
on May 19, 2010 at 16:40 UTC ( #840731=perlquestion: print w/replies, xml ) Need Help??
roho has asked for the wisdom of the Perl Monks concerning the following question:

I'm getting a "SetConsoleMode failed" error message when I try to use the Perl debugger. I am running ActivePerl 5.8.9 Build 827 on Windows Vista Home Premium. I get the same error on my XP machine (same Perl setup). Is this a known problem with Perl on Windows?

Versions of modules mentioned in the error message.

C:\>ppm query term-r* +--------------------+-----------+------------------------------------ +-+------+ | name | version | abstract + | area | +--------------------+-----------+------------------------------------ +-+------+ | Term-ReadKey | 2.30 | Change terminal modes and perfor... + | perl | | Term-ReadLine | 1.03 | + | perl | | Term-ReadLine-Perl | 1.0302-r1 | Readline implementation in Perl + | perl | | Term-ReadLine-Perl | 1.0303 | + | site | +--------------------+-----------+------------------------------------ +-+------+ C:\>perl -d Loading DB routines from version 1.31 Editor support available. Enter h or 'h h' for help, or 'perldoc perldebug' for more help. main::( my $x = 1; SetConsoleMode failed, LastError=|6| at C:/Perl/lib/Term/ li +ne 265. at C:/Perl/site/lib/Term/ReadLine/ line 1581 readline::readline(' DB<1> ') called at C:/Perl/site/lib/Term +/ReadLine/ line 11 Term::ReadLine::Perl::readline('Term::ReadLine::Perl=ARRAY(0x3 +62d3f0)', ' DB<1> ') called at C:/Perl/lib/ line 6422 DB::readline(' DB<1> ') called at C:/Perl/lib/ line + 2235 DB::DB called at line 9 DB<1> x $x

"Its not how hard you work, its how much you get done."

Replies are listed 'Best First'.
Re: Problem Running Perl Debugger
by SilasTheMonk (Chaplain) on May 19, 2010 at 23:56 UTC

    I don't know what is going on here, but I can spot three things that might shed light on the issue.

    1. You have two versions of Term::Readline::Perl installed. I'm not saying I cannot see reasons why that could be, but you might want to elaborate on how it came about.
    2. About 20% of tests for Term::Readline::Perl failed and there a number of bugs. I would also say "have you read the docs", but there does not seem to be any.
    3. Searching for "SetConsoleMode" through the various modules mentioned threw up this interesting snippet in Term::ReadLine
    4. # the Windows CONIN$ needs GENERIC_WRITE mode to allow # a SetConsoleMode() if we end up using Term::ReadKey open FIN, ( $^O eq 'MSWin32' && $console eq 'CONIN$' ) ? "+<$cons +ole" : "<$conso +le"; open FOUT,">$consoleOUT"; #OUT->autoflush(1); # Conflicts with debugger? my $sel = select(FOUT); $| = 1; # for DB::OUT select($sel); $ret = bless [\*FIN, \*FOUT]; } else { # Filehandles supplied $FIN = $_[2]; $FOUT = $_[3]; #OUT->autoflush(1); # Conflicts with debugger? my $sel = select($FOUT); $| = 1; # for DB::OUT select($sel); $ret = bless [$FIN, $FOUT]; }
      Have you tried posting a small piece of code that reproducibly causes the problem?
      Thanks for your reply. The reason there are two versions of Term::ReadLine::Perl is that one is core (area=perl) and the other is a more recent update from CPAN (area=site).

      Entering 'perl -d' will reproduce the error.

      "Its not how hard you work, its how much you get done."

Re: Problem Running Perl Debugger
by Khen1950fx (Canon) on May 19, 2010 at 20:07 UTC
    Check your environmental variables. I don't use Windows, but on my system, I use xterm, for example, TERM=xterm. Try setting it to TERM=dumb to get rid of the warning.

      Thanks for this.

      I run Strawberry Perl portable, and seldom use the debugger, so only today discovered that perl -dE 1 gives me the same warning. Which surprised me, as I start Perl from a shortcut that calls my own batch file before calling portableshell.bat, and in my batch file I have set TERM=dumb.

      Turns out that between versions 5.18.2 and 5.20.0 the relevant line in portableshell.bat was changed from set TERM=dumb to set TERM=. (So I hadn’t noticed that the second batch file was overriding this set command in the first batch file. Careless. :-( ) By commenting out this line I am now able to set TERM in my own batch file. Problem solved.

      Just thought I’d mention this here in case it helps someone else searching for help on the same problem.

      Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://840731]
Approved by ww
Front-paged by ikegami
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-08-19 15:35 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (311 votes). Check out past polls.