ActiveState announces ActivePerl 5.14.2

2011-10-13 Thread Jan Dubois
ActiveState is pleased to announce ActivePerl 5.14.2 build 1402,
a complete, ready-to-install binary distributions of Perl.

Builds for Windows, Mac OS X and Linux are made freely available.
Builds for Solaris, HP-UX and AIX are available with ActivePerl Business
Edition. For detailed information or to download these releases, see:

  http://www.activestate.com/activeperl


What's new in ActivePerl


ActivePerl 5.14 is now based on the 5.14.2 release. You can read about all
the changes since Perl 5.14.1 in this perldelta document:

  http://docs.activestate.com/activeperl/5.14/lib/pods/perl5142delta.html


Getting Started
===

Whether you're a first-time user or a long-time fan, our free resources
will help you get the most from ActivePerl.

Mailing list archives:

  http://code.activestate.com/lists/activeperl/


Supported Platforms
===

ActivePerl is available for the following platforms:

- Windows/x86   (32-bit)
- Windows/x64   (64-bit) (aka AMD64)
- Mac OS X
- Linux/x86 (32 bit)
- Linux/x86_64  (64-bit) (aka AMD64)

- Solaris/SPARC (32-bit and 64-bit) (Business Edition only)
- Solaris/x86   (32-bit)(Business Edition only)
- HP-UX/PA-RISC (32-bit)(Business Edition only)
- AIX/PowerPC   (32-bit)(Business Edition only)

More information about the Business Edition can be found here:

  http://www.activestate.com/business-edition

Custom builds are available in the Enterprise Edition:

  http://www.activestate.com/enterprise-edition


Feedback


Everyone is encouraged to participate in making Perl an even better
language.

For bugs related to ActiveState use:

  http://bugs.activestate.com/enter_bug.cgi?product=ActivePerlversion=1402

For bugs related directly to Perl please use the 'perlbug' utility.

Enjoy!


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Non blocking keyboard

2011-10-13 Thread Barry Brevik
Last week I had posted a query about getting keyboard input in a non
blocking way.

I received several replies, so I thought I would post back the code I
developed which seems to work.

This is not the code I will end up using; it is more like a proof of
concept program.

use strict;
use warnings;
use Win32::Console;

my $signame = '';
my $havebrk = 0;

$SIG{INT}   = sub {$signame = $_[0]; $havebrk = 1;};# CTRL-C.
$SIG{BREAK} = sub {$signame = $_[0]; $havebrk = 1;};# CTRL-BREAK,
CTRL-ScrollLock.

my $STDIN = new Win32::Console(STD_INPUT_HANDLE);
$STDIN - Mode(ENABLE_PROCESSED_INPUT);

while (1)
{
  if ($STDIN-GetEvents())
  {
# We do this inner loop here to make shure that we read
# all of the characters in the key buffer.
while ($STDIN-GetEvents())
{
# Read console event.
my @input = $STDIN-Input();

  # input[0] is the event type- 1 for keyboard, 2 for mouse. So what
is 0 for?
if (defined $input[0] and $input[0] == 1)
  {
my ($eventType, $keyState, $keyCount, $keyCode, $scanCode,
$keyValue, $keyFlags) = @input;

if ($havebrk) {die User termination on signal $signame.\n\n;}

# KeyState of 1 means key down.
if ($keyState == 1)
{
  if ($keyValue == 0x00)
  {
# Most control keys fall in here.
if ($keyCode == 16)  {print \nSHIFT key pressed.\n;}
if ($keyCode == 17)  {print \nCTRL key pressed.\n;}
if ($keyCode == 18)  {print \nALT key pressed.\n;}
if ($keyCode == 19)  {print \nBREAK key pressed.\n;}
if ($keyCode == 20)  {print \nCAPS LOCK key pressed.\n;}
if ($keyCode == 33)  {print \nPG UP key pressed.\n;}
if ($keyCode == 34)  {print \nPG DN key pressed.\n;}
if ($keyCode == 35)  {print \nEND key pressed.\n;}
if ($keyCode == 36)  {print \nHOME key pressed.\n;}
if ($keyCode == 37)  {print \nLEFT ARROW key pressed.\n;}
if ($keyCode == 38)  {print \nUP ARROW key pressed.\n;}
if ($keyCode == 39)  {print \nRIGHT ARROW key pressed.\n;}
if ($keyCode == 40)  {print \nDOWN ARROW key pressed.\n;}
if ($keyCode == 45)  {print \nINS key pressed.\n;}
if ($keyCode == 46)  {print \nDEL key pressed.\n;}
if ($keyCode == 91)  {print \nLEFT WINDOWS key
pressed.\n;}
if ($keyCode == 92)  {print \nRIGHT WINDOWS key
pressed.\n;}
if ($keyCode == 93)  {print \nCONTEXT key pressed.\n;}
if ($keyCode == 112) {print \nF1 pressed.\n;}
if ($keyCode == 113) {print \nF2 pressed.\n;}
if ($keyCode == 114) {print \nF3 pressed.\n;}
if ($keyCode == 115) {print \nF4 pressed.\n;}
if ($keyCode == 116) {print \nF5 pressed.\n;}
if ($keyCode == 117) {print \nF6 pressed.\n;}
if ($keyCode == 118) {print \nF7 pressed.\n;}
if ($keyCode == 119) {print \nF8 pressed.\n;}
if ($keyCode == 120) {print \nF9 pressed.\n;}
if ($keyCode == 121) {print \nF10 pressed.\n;}
if ($keyCode == 122) {print \nF11 pressed.\n;}
if ($keyCode == 123) {print \nF12 pressed.\n;}
if ($keyCode == 144) {print \nNUM LOCK pressed.\n;}
if ($keyCode == 145) {print \nSCROLL LOCK pressed.\n;}
  }

  elsif ($keyValue = 0x7f)
  {
# High line draw chars etc fall in here, however
# I was never able to get it to trigger.
print High char pressed.\n;
  }

  else
  {
# *Almost* Everything else is a printable ASCII character.
if($keyValue ==  8) {print BACKSPACE key pressed.\n;}
elsif ($keyValue ==  9) {print TAB key pressed.\n;}
elsif ($keyValue == 13) {print ENTER key pressed.\n;}
elsif ($keyValue == 27) {print ESC key pressed.\n;}
else
{
  # When here, presumably a printable character has been
pressed.
  my $keyChr = chr($keyValue);
  print \nChar pressed: $keyChr\n;
}
  }
}

# KeyState of 0 means that a key was released.
elsif ($keyState == 0)
{
  if ($keyValue == 0x00)
  {
if ($keyCode == 16)  {print SHIFT key released.\n\n;}
if ($keyCode == 17)  {print CTRL key released.\n\n;}
if ($keyCode == 18)  {print ALT key released.\n\n;}
if ($keyCode == 19)  {print BREAK key released.\n\n;}
if ($keyCode == 20)  {print CAPS LOCK key released.\n\n;}
if ($keyCode == 33)  {print PG UP key released.\n\n;}
if ($keyCode == 34)  {print PG DN key released.\n\n;}
if ($keyCode == 35)  {print END key released.\n\n;}
if ($keyCode == 36)  {print HOME key released.\n\n;}
if ($keyCode == 37)  {print LEFT ARROW key