On 28 Nov 2019, at 05:07, ToddAndMargo via perl6-users <perl6-users@perl.org> 
wrote:

Hi All,

C:\NtUtil>perl6 -v
This is Rakudo Star version 2019.03.1 built on MoarVM
version 2019.03 implementing Perl 6.d for Windows


What am I doing wrong here?

<WinVer.pm6>
unit module WinVer;
# WinVer.pm6

sub WinVer() is export( :WinVer ) {
#`{
      Reference: https://www.gaijin.at/en/infos/windows-version-numbers

      Return a string with the name of the Windows version:

}

   my %Ver = (
      "5.10"       => "Windows XP",
      "6.10"       => "Windows 7",
      "6.20"       => "Windows 8",
      "6.30"       => "Windows 8.1",
      "10.0.10240" => "Windows 10-1507",
      "10.0.10586" => "Windows 10-1511",
      "10.0.14393" => "Windows 10-1607",
      "10.0.16299" => "Windows 10-1709",
      "10.0.17134" => "Windows 10-1803",
      "10.0.17763" => "Windows 10-1607",
      "10.0.18362" => "Windows 10-1903",
      "10.0.18363" => "Windows 10-1909" );

   my Str $RtnStr;
   my Str $Version;

   say %Ver;
   # $RtnStr = qx ( ver );
   # for %Ver -> $Key  {
   #    say $Key;
   # }

}
</WinVer.pm6>


C:\NtUtil>perl6 -e "use lib 'C:\NtUtil'; use WinVer :WinVer; WinVer;"

WARNINGS for -e:
Useless use of constant value WinVer in sink context (line 1)

On 2019-11-27 20:50, Elizabeth Mattijsen wrote:
> Try naming the sub a different name from the class.  For
> some reason "WinVer" is referring to the "WinVer" type
> object, instead of the WinVer sub.  This may be a case
> of DIHWIDT, or a bug, not sure.
>

Hi Elizabeth,

I got the "Big Guns" helping me!  :-)

I got it to work by comments out the first line
   #  unit module WinVer;

????????  Bug or feature? This is running in
Windows after all.

Thank you for the help!

-T

<WinVer>
# unit module WinVer;
# WinVer.pm6

sub WinVer() is export( :WinVer ) {
#`{
      Reference: https://www.gaijin.at/en/infos/windows-version-numbers

      Return a string with the name of the Windows version:

}

   my %Ver = (
      "5.1"        => "Windows XP",
      "6.1"        => "Windows 7",
      "6.2"        => "Windows 8",
      "6.3 "       => "Windows 8.1",
      "10.0.10240" => "Windows 10-1507",
      "10.0.10586" => "Windows 10-1511",
      "10.0.14393" => "Windows 10-1607",
      "10.0.16299" => "Windows 10-1709",
      "10.0.17134" => "Windows 10-1803",
      "10.0.17763" => "Windows 10-1607",
      "10.0.18362" => "Windows 10-1903",
      "10.0.18363" => "Windows 10-1909" );
   # say %Ver;

   my Str $RtnStr;
   my Str $Version = "";

   $RtnStr = qx ( ver );
   # say $RtnStr;

   for %Ver.kv -> $Key, $Value  {
      if $RtnStr.contains( $Key )  { $Version = $Value; }
   }

   say $Version;
   # return $Version;
}
</WinVer>


C:\NtUtil>perl6 -e "use lib 'K:\Windows\NtUtil'; use WinVer :WinVer; WinVer;"

Windows 10-1909

I love hashes!

Reply via email to