Note that the Win32::Console module does not support Unicode. I'm supposing it only calls the narrow version of the API.
Now I'm contemplating making a polished module for this. I want feedback before I get around to making this more mature implementation and uploading it.
The prospective name is Win32::ConsoleOutput, but I'm still taking suggestions.
The primary purpose is to allow Perl programs to print output to the interactive console window, using the full character set.
Upon using this module, you can open a Perl handle (really a tie, not an actual file handle that the OS knows about) to do Console output, and it will take Perl's native encoding and make it just work.
There will be a handy way to tell it to replace STDOUT with this, if and only if STDOUT is not being redirected.
I'm also thinking about a related issue: more advanced terminal control. Other kinds of processing of the data stream are already handled by making a filter handle that sits in front of the real output, so the only business this has should be terminal-related stuff. In particular, changing colors and moving the cursor around.
Previously, it's been voiced that nobody likes the ANSI terminal stuff. Here's an idea for an extension mechanism that can handle this or whatever:
Have a hash as part of the ConsoleOutput object that maps characters to callbacks. Print a character that's listed, and the callback is invoked and the character filtered out. Use a couple chars in the Private Use zone to implement color codes, or add whatever you want. As a shortcut, a string (rather than a code ref) is a substitution. Use that to replace unprintable characters or specify alternate glyphs.
What do you think?
—John
In reply to Module idea: Win32::ConsoleOutput by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |