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

I just recently re-installed Windows 8.1 on my machine and re-installed Perl. I made sure the Win32::Console::ANSI package is installed, but color is still not working for me. When I run my script, which is supposed to display colored text, I get this... ←[1;34mC:\Programs\Multi-Edit 2008←[1;37m How do I get color back?

Replies are listed 'Best First'.
Re: Win32::Console::ANSI not working
by Corion (Patriarch) on Aug 22, 2015 at 12:30 UTC

    Can you show us a minimal program that exhibits the problem?

    I would imagine it looks something like:

    #!perl -w use strict; use Win32::Console::ANSI; print "\e[1;34mC:\\Programs\\Multi-Edit 2008\e[1;37m\n"

    ... but that program works for me on Windows 7, displaying the text C:\Programs\Multi-Edit 2008 in blue and then switching to strong white.

Re: Win32::Console::ANSI not working
by afoken (Chancellor) on Aug 22, 2015 at 14:12 UTC
    I get this... ←[1;34mC:\Programs\Multi-Edit 2008←[1;37m

    In the old ages of MS-DOS, I would have said that you forgot to load ANSI.SYS. It seems that Windows 8.1 can switch off interpreting ANSI sequences, or does not support them natively. https://www.liferay.com/de/web/igor.spasic/blog/-/blogs/enable-ansi-colors-in-windows-command-prompt (and others) suggests that you need third party software to enable ANSI sequences.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Win32::Console::ANSI not working
by bobt_2004 (Initiate) on Aug 23, 2015 at 11:17 UTC
    Thanks for the help guys. Yes, the first response displays exactly my code. I forgot about the formatting tags so I couldn't get it to format, that's why I didn't type the entire script. Interestingly, I downloaded a 3rd party thing called "ansicon.dll" and installed it, now I can type text files that have those sequences in it and it displays color. However, the Perl code doesn't (whether I use Win32::Console::ANSI or not). Even more strange, the alternate way of setting screen attributes using Win32::Console does work.
    my $console_handle = Win32::Console->new(STD_OUTPUT_HANDLE()); $console_handle->Attr($FG_CYAN); print "Multi-Edit 2008\n"; $console_handle->Attr($FG_WHITE); print "Normal text again\n";
    The code above does work, and it displays cyan text and then bright white text. Why the ANSI codes stopped working is beyond me. It could have something to do with a Windows 8.1 update that made it stop working?
      Why the ANSI codes stopped working is beyond me. It could have something to do with a Windows 8.1 update that made it stop working?

      It's possible; but I would have expected to have heard about it before now if that were the case.

      Could you post the output from the command on the machine:

      set

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
      In the absence of evidence, opinion is indistinguishable from prejudice.
      I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!