I am posting a success instead of a failure, for a change ;-). In brief, I've patched the test file for Win32::Netsh so that the Wlan instance tests no longer fail (on a recent Windows release). I first wrote a short subroutine which I'll submit here for comments and critiques:
#!/usr/bin/env perl use strict; use v5.18; use utf8; use warnings; use Carp qw/carp croak/; =head1 DESCRIPTION Find the major Windows version from the commandline "ver" command. =cut # ------------------------------------------------------- # # Example Windows 11 version string (bought the machine # with Windows 10 loaded on it): # Microsoft Windows [Version 10.0.26100.4349] # ------------------------------------------------------- # sub findVer { my ( $which , $verstr ); $verstr = `ver`; chomp $verstr; $verstr =~s{\A\n}{}; $verstr =~m'\[Version\s (\d+) [.]'x; carp( qq/Couldn't get version from string "$verstr"/ ) unless $1; $which = $1; return $which; } say findVer(); __END__
The reason it matters to Win32::Netsh is that at some vague point in time (Google AI doesn't know exactly when), M$ stopped calling a wireless interface a "Wireless Network Connection" and started calling it a "Wi-Fi". This broke the Win32::Netsh test suite file 02-Win32-Netsh-Wlan.t for my machine. Here's the patch (Unified diff format, line endings converted to UNIX). I'd be very interested in hearing from other Windows Perlers how this patch works on their version of Windows (I'm going to test it on Windows7):
Jun 18, 2025 at 20:50 UTC--- a/t/02-Win32-Netsh-Wlan.t 2015-11-17 16:07:55.000000000 -0500 +++ b/t/02-Win32-Netsh-Wlan.t 2025-06-18 14:52:56.388437700 -0400 @@ -26,36 +26,61 @@ ); } use_ok(qq{Win32::Netsh::Wlan}, (qw(:all))); } +##--------------------------------------- +## Find Windows Version + +# ------------------------------------------------------- # +# Example Windows 11? or 10? version string: +# Microsoft Windows [Version 10.0.26100.4349] +# ------------------------------------------------------- # +sub findVer +{ + my ( $which , $verstr ); + $verstr = `ver`; + chomp $verstr; + $verstr =~s{\A\n}{}; + $verstr =~m'\[Version\s (\d+) [.]'x; + carp( qq/Couldn't get Windows version from string "$verstr"/ ) un +less $1; + $which = $1; + # say "VERSION: " . $which; + return $which; +} + +my $generation = findVer(); ##--------------------------------------- ## List of profiles to use for testing ##--------------------------------------- my @test_profiles = ( { filename => qq{win32-netsh-wlan-single.xml}, info => { name => qq{Win32-Netsh-Wlan-Single}, auth => qq{Open}, cipher => qq{None}, - interface => qq{Wireless Network Connection}, + interface => ( $generation >= 10 ? + qq{Wi-Fi} + : qq{Wireless Network Connection} ), mode => qq{automatical}, net_type => qq{Infrastructure}, radio => qq{[ Any Radio Type ]}, ssid => [qq{SSID-Single}], }, }, { filename => qq{win32-netsh-wlan-dual.xml}, info => { name => qq{Win32-Netsh-Wlan-Dual}, auth => qq{Open}, cipher => qq{None}, - interface => qq{Wireless Network Connection}, + interface => ( $generation >= 10 ? + qq{Wi-Fi} + : qq{Wireless Network Connection} ), mode => qq{automatical}, net_type => qq{Infrastructure}, radio => qq{[ Any Radio Type ]}, ssid => [ qq{SSID-Dual-01}, qq{SSID-Dual-02}
In reply to Win32::Netsh tests repaired (-: by Intrepid
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |