in reply to Re^9: Win32 Serial Under Windows 7
in thread Win32 Serial Under Windows 7

5.16 as i tried to keep the same versions and modules the same perl on windows 7, vista and xp....the script works fine on those machines.....just not windows 10

Replies are listed 'Best First'.
Re^11: Win32 Serial Under Windows 7
by pryrt (Abbot) on Apr 06, 2018 at 19:15 UTC

    The script I posted works on my Windows 10 with Strawberry 5.26.0 -- so ReadKey works on Windows 10. Which means there might be something different about your installation of Strawberry perl. Which is why I asked for the output of the long-form perl -V (that's a capital V), which gives many more details about the specifics of your installation. I am hoping it may show the subtle differences between your install and mine. Hence, I will ask again, but more explicitly this time: please include the full output of perl -V (capital V) inside <code> tags in your response.

    Also, please include the output from C:\>perl -MTerm::ReadKey -lE "say $Term::ReadKey::VERSION" (which for mine is 2.37_01).

    When I save the program I mentioned previously as "C:\usr\local\share\PassThru\perl\perlmonks\1212444.pl", then do Win+R (Windows > Run), and run cmd /k perl "C:\usr\local\share\PassThru\perl\perlmonks\1212444.pl", or when I run a cmd.exe window and run perl "C:\usr\local\share\PassThru\perl\perlmonks\1212444.pl", I get the results I showed. When you ran my script, how exactly did you run it? Did you have a cmd.exe window open already (or a powershell, or some other shell)? Or did you run it from Win+R? Are you going through a file association (running it as "1212444.pl", or double-clicking the file through Explorer), or do you explictly run it as "perl 1212444.pl"? I am looking for subtleties, so please don't skimp on details.

      Here is the perl -V output:
      Microsoft Windows [Version 10.0.16299.309] (c) 2017 Microsoft Corporation. All rights reserved. C:\Users\Scott>perl -V Summary of my perl5 (revision 5 version 16 subversion 3) configuration +: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='Win32 strawberry-perl 5.16.3.1 #1 Tue Mar 12 13:55:20 2013 +i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPER +L_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitf +ields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.6.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long lo +ng', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\straw +berry\c\lib"' libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 +-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -l +mpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdl +g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_3 +2 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl516.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE +" -L"C:\strawberry\c\lib"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB +_ALLOC USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under MSWin32 Compiled at Mar 12 2013 14:01:07 @INC: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib . C:\Users\Scott>
      Here is the output of term readkey:
      2.37
      I copied and pasted your program into notepad....saved it as test.pl and ran it using the strawberry perl interpreter from the run start menu and I also right clicked it and ran it with the strawberry perl command interpreter

        You said you were using perl 5.26, but you showed 5.16.3; I tried on my 5.16.3 64-bit installation (your as shown is 32bit), but the Term::ReadKey worked there, too. Your Term::ReadKey version is 2.37, whereas mine is 2.37_01. Maybe Strawberry patched it (Term::ReadKey is in the "vendor/lib/Term/ReadKey.pm" of my Strawberry 5.26.0 64bit installation; when I look on cpan, Term::ReadKey lists 2.37, so that's why I assumed it was a strawberry patch), so you might want to verify that you've really got the strawberry installation you think you have (since you claimed 5.26, but showed 5.16.3).

        I tried again, showing my whole sequence, trying with my default 5.26.0_64, the older 5.16.3_64, and just now also tried a 32bit version (5.26.1_32). All three worked for me. Two of the three were using Term::ReadKey version 2.37_01.

        Mine: C:\usr\local\share\PassThru\perl\perlmonks>perl -lE "use Term::ReadKey +; say $Term::ReadKey::VERSION; say $INC{'Term/ReadKey.pm'}" 2.37_01 C:/usr/local/apps/berrybrew/perls/5.26.0_64_PDL/perl/vendor/lib/Term/R +eadKey.pm C:\usr\local\share\PassThru\perl\perlmonks>perl 1212444.pl Test Test Exit With Key q C:\usr\local\share\PassThru\perl\perlmonks>berrybrew use 5.16.3_64 perl-5.16.3_64 ============== Microsoft Windows [Version 10.0.16299.248] (c) 2017 Microsoft Corporation. All rights reserved. <berrybrew use 5.16.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl\perlmonks>perl -lE "use Term::ReadKey +; say $Term::ReadKey::VERSION; say $INC{'Term/ReadKey.pm'}" 2.30.02 C:/usr/local/apps/berrybrew/perls/5.16.3_64/perl/vendor/lib/Term/ReadK +ey.pm <berrybrew use 5.16.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl\perlmonks>perl 1212444.pl Test Test Exit With Key q <berrybrew use 5.16.3_64>: run "exit" leave this environment C:\usr\local\share\PassThru\perl\perlmonks>exit Exiting <berrybrew use 5.16.3_64> C:\usr\local\share\PassThru\perl\perlmonks>berrybrew use 5.26.1_32 perl-5.26.1_32 ============== Microsoft Windows [Version 10.0.16299.248] (c) 2017 Microsoft Corporation. All rights reserved. <berrybrew use 5.26.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl\perlmonks>perl -lE "use Term::ReadKey +; say $Term::ReadKey::VERSION; say $INC{'Term/ReadKey.pm'}" 2.37_01 C:/usr/local/apps/berrybrew/perls/5.26.1_32/perl/vendor/lib/Term/ReadK +ey.pm <berrybrew use 5.26.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl\perlmonks>perl 1212444.pl Test Test Exit With Key x <berrybrew use 5.26.1_32>: run "exit" leave this environment C:\usr\local\share\PassThru\perl\perlmonks>exit Exiting <berrybrew use 5.26.1_32>

        Right now, I'm leaning towards guessing there may have been a bug or Strawberry incompatibility in Term::ReadKey 2.37, which Strawberry patched in 2.37_01, but that you aren't using that because you're actually using an older Strawberry than you thought.