sub Win_OS_Type { return unless $^O =~ /win32|dos/i; # is it a MS box? # It _should_ have Win32 unless something is really weird return unless eval('require Win32'); # Use the standard API call to determine the version my ( undef, $major, $minor, $build, $id ) = Win32::GetOSVersion; return "win32s" unless $id; # If id==0 then its a win32s box. my $os = { # Magic numbers from MSDN documentation of GetOSVersion 1 => { 0 => "95", 10 => "98", 90 => "Me" }, 2 => { 0 => "2000", 1 => "XP/.Net", 51 => "NT3.51" } }->{$id}->{$minor}; # This _really_ shouldnt happen. At least not for quite a while die "$id:$major:$minor Has no name of record!" unless defined $os; # Unfortunately the logic used for the various versions isnt so clever.. # so we have to handle an outside case. return ( $os eq "2000" & $major != 5 ) ? "NT4" : $os; }