On Sat, Apr 09, 2016 at 05:00:20PM -0700, L Walsh wrote: > > Looking at the docs for Win32, it shows the GetOSVersion command, and > says: > Currently known values for ID MAJOR and MINOR are as follows: > > OS ID MAJOR MINOR ... > > ---- > However, I'm getting a FAIL report: > http://www.cpantesters.org/cpan/report/59eac143-6c80-1014-98cd-5d0f2b7077ee > > where the Win32::GetOSVersion is returning: > > Service Pack 3, 5, 1, 2600, 2, 3, 0, 256, 1 > > It doesn't seem that "Service Pack 3" is a valid value for "OS".
Nothing in the Win32.pm documentation claims that GetOSVersion() returns "OS" in he first member of the list. The string returned is "An arbitrary descriptive string". GetOSVersion() is a wrapper around the GetVersionEx() Win32 API: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 https://msdn.microsoft.com/en-us/library/windows/desktop/ms724833%28v=vs.85%29.aspx ... for which the azCSDVersion is described as "A null-terminated string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty." If you want to blame anyone for the uselessness of that string, blame Microsoft. > For GetOSName, it has WinXP/.Net -- which is also not a valid > OS name. "WinXP/.Net" is listed as one of the possible return values for GetOSName(), which makes it valid. > I've encountered multiple "quirks" where Strawberry Perl doesn't > return documented values. I'm also using "^O", to try to determine > if I'm running on a windows platform and if it is safe to call > the Win32 functions -- the Win32 section for ^O says: > > In Windows platforms, $^O is not very helpful: since it is > always "MSWin32", it doesn't tell the difference between > 95/98/ME/NT/2000/XP/CE/.NET. Use "Win32::GetOSName()" or > Win32::GetOSVersion() (see Win32 and perlport) to distinguish > between the variants. > > Using Win32 calls on non-win32 platforms usually results in > errors, so the advice saying $^O is not very helpful -- and > to use non-portable Win32 calls instead -- is itself, not very helpful. > I'm expecting some "sanity" in $^O, and am hoping that > $^O =~ /^.*Win.*$/ will return "true" if it is on a Win platform. Check if $^O eq "MSWin32", then call the Win32::* functions. Depending on your needs you might want to check if $^O eq "cygwin". > But $^O isn't documented/listed on the CPAN Reporter's "report". > > At the very least, shouldn't "OS" be one of the listed values > in the documentation table? I've probably spun at least 10 > or more versions of "P" just trying to get 1 test to run, or, > now, just skipping those tests. An abstract operating system name is in the subject of the report: Subject: FAIL P-1.1.32 v5.22.1 Windows (Win32) (abstract as in "not $^O".) It's also in the header: Perl special variables (and OS-specific diagnostics, for MSWin32): (The rest I have no comment on, except that p5p still supports XP, just as other unsupported operating systems are still supported.) Tony