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

I humbly ask my question...

I am running Perl in debug mode on Windows 2000 in a console window (a DOS box). When I go to help by typing 'h' (or '|h') in the debug interface, I see what looks like embedded formatting codes that contain left arrows and square brackets, numbers and letters (I have tried to reproduce one line faithfully here by using code brackets interspersed with entity notation for the left arrow):

[1ma[0m [[4;mline]        Delete the action for[4;mline.

These sequences or formatting codes show on every line, around every command character. I would like the formatting codes to go away, or be interpreted as whatever effect they are meant to apply, because in their raw display, they obfuscate the characters that help is trying to explain. I see this effect on all three of my work machines, and whether I run cmd or command, so I presume it must be something that happens to others. I have looked around for answers, including reading the debugger faq on this site, but no one seems to have any comment on this.

Thanks for any help you can provide.

I feel that I must be missing something obvious. I would be happy with a solid pointer to where I can read more about what I might be doing wrong.

Replies are listed 'Best First'.
Re: Stymied by formatting characters
by hardburn (Abbot) on Feb 03, 2004 at 20:24 UTC

    Taking hv's reply as truth, you could try using Cygwin (external link). It gives you Unix tools for Windows, and should do the formatting codes correctly.

    FYI--They're ANSI escape codes, documented at http://www.rt.com/man/console_codes.4.html.

    ----
    I wanted to explore how Perl's closures can be
    manipulated, and ended up creating an object
    system by accident.
    -- Schemer

    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

      Hardburn,

      Thank you.

      I will try Cygwin. And thanks for the ANSI reference.

      -Marty
Re: Stymied by formatting characters
by hv (Prior) on Feb 03, 2004 at 20:15 UTC

    They look like standard (Unixish) escape sequences to control formatting. I have little experience of the debugger, but looking at perldoc perldebug I notice this section:

           "ornaments" Affects screen appearance of the command line
                       (see Term::ReadLine).  There is currently no
                       way to disable these, which can render some
                       output illegible on some displays, or with
                       some pagers.  This is considered a bug.
    

    Assuming this deficiency still exists in the code, and not just in the documentation, you may still take hope from the fact that substantial reworking of the debugger is ongoing for the development track of perl, and it is possible that now would be a good time for a carefully worded reminder (via perlbug) of the problem.

    Hope this helps,

    Hugo

Re: Stymied by formatting characters
by bart (Canon) on Feb 04, 2004 at 01:02 UTC
    You might want to play with Win32::Console::ANSI. What you have looks like typical terminal controlling escape sequences, too me. If these strings are printed from within perl, then with this module, you should get a multi-colored output.

    Granted, the module isn't perfect, for example screens with areas in different colors, scroll badly, but it definitely will give you a sense of what it's all about.

Re: Stymied by formatting characters
by sailorsonoftailor (Initiate) on Feb 03, 2004 at 20:33 UTC
    Hugo,

    Thanks. That helps, somewhat. Knowing it is a bug, I won't feel like a wimp when I go instead to an HTML presentation of the same data.

    I will follow up on the perlbug post, as soon as I read up on how its done.

    -Marty
Re: Stymied by formatting characters
by ysth (Canon) on Feb 03, 2004 at 22:07 UTC
    I don't see this (ActiveState Perl build 806 on XP Pro). Grasping at straws, what version of perl is this? Is it ActiveState? Does the debugger say anything about ReadLine support when it starts up? If you say perl -MCPAN -eshell, does that say anything about ReadLine support when it starts up? What does SET TERM show? How about SET PERL_RL? Does entering SET PERL_RL= o=0(thats 'equal','space','little-oh','equal','zero') at the command prompt fix it?
      Unfortunately, simply using Cygwin is not enough to avoid the problem - but I am glad to know about Cygwin. We have used MKSToolkit where I work in the past.

      In regard to the version:

      C:\Scripts\PERL\Helpers>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary based on sources for build 626 provided by ActiveState Tool Corp. http://www.ActiveState.com Built 23:32:43 May 10 2001
      In answer to your question about Readline and Set Term (and this is probably the most significant thing.):

      C:\Scripts\PERL\Helpers>perl -MCPAN -eshell cpan shell -- CPAN exploration and modules installation (v1.59_54) ReadLine support enabled SetConsoleMode failed, LastError=|6| at C:\PERL\SITE\LIB/Term/ReadKey. +pm line 24 5. cpan>