On Mon, 18 Dec 2006 15:10:39 -0500, Michael G Schwern <[EMAIL PROTECTED]> wrote:

>So that I understand what's going on here... the Win32:: functions have been 
>removed
>from miniperl so determining the Windows version in miniperl has become more 
>complex.
>Ok, but I cringe a bit at the indirect way the new checks are written.  "If 
>some
>DynaLoader function exists, then we can use a  Win32 function.  Else, check 
>some
>obscure environment variable to determine if its Win95 or Win32."
>
>How about something more direct...
>
>$IsWin95 = defined &Win32::IsWin95 ? Win32::IsWin95() : !defined 
>$ENV{SYSTEMROOT};
>
>The outwardly unrelated DynaLoader is completely removed from the equation, 
>this better
>future proofs uses of Win32::, and the purpose of using SYSTEMROOT as a 
>fallback
>is made plain.

Sure, the problem is that your code doesn't work.  The function is always 
defined
for backward compatibility reasons.  It just implemented something like this 
(in XS):

  sub Win32::IsWin95 {
      eval "use Win32 0.27";
      die $@ if $@;
      goto &Win32::IsWin95;
  }

Therefore your version will just die on Win9X.  A better fix would be to
add more documentation about the situation:

  # The Win32::IsWin32() requires a working DynaLoader, so it will not be 
available
  # under miniperl.  In that case we fall back checking for the existence of
  # $ENV{SYSTEMROOT}.  This environment variable has been introduced on Windows 
NT
  # and is not normally defined on Windows 9X.

[...]

>Also, is it necessary to say "use Win32" now?

No, it is not necessary (that would break backwards compatibility), but it
is recommended, as it would make sure you load the latest version of the
functions in case you have upgraded Win32 from CPAN.

But remember that "use Win32" will not work under miniperl, so don't do it
in MakeMaker!

Cheers,
-Jan

Reply via email to