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.
> 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)