Having finally found a Win32 system, I tried this and you're right. You can tell IF one of these keys is pressed but not which one. If the return is truly undef, then nothing was pressed, if it's a null byte (ord($c)==0 and length $c) then one of these other keys was pressed.
The Win32PeekChar routine is an XS routine, it interfaces C and Perl. Looking at the module's source it doesn't look like its at all equipped to give a multibyte return value -- so you're screwed. The Win32 API calls used (PeekConsoleInput, ReadConsoleInput, WaitForSingleObject) might provide the raw information to Win32PeekChar but I'm not going to research the Win32 API for someone else's question. I'm not a masochist. :)
It is possible to do this because the Tk module can catch these kinds of events. But Tk is a hefty beast if all you want is to catch keystrokes. Perhaps brush up on your C programming and fix ReadKey.xs to do the Right Thing.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.