From cf90f796e31b55fcf578ea4dd42c63d00d703616 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Sat, 10 Sep 2016 18:32:56 -0400 Subject: Bug 1260020 - Use Win32::GetConsoleOutputCP() instead of Win32::Console::OutputCP() --- Bugzilla/Install/Util.pm | 19 ++++++++----------- Makefile.PL | 7 +++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index d8882a71b..f85378b47 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -24,6 +24,8 @@ use POSIX qw(setlocale LC_CTYPE); use Scalar::Util qw(tainted); use Term::ANSIColor qw(colored); use PerlIO; +use if ON_WINDOWS, 'Win32'; +use if ON_WINDOWS, 'Win32::API'; use parent qw(Exporter); our @EXPORT_OK = qw( @@ -73,10 +75,8 @@ sub get_version_and_os { my @os_details = POSIX::uname; # 0 is the name of the OS, 2 is the major version, my $os_name = $os_details[0] . ' ' . $os_details[2]; - if (ON_WINDOWS) { - require Win32; - $os_name = Win32::GetOSName(); - } + $os_name = Win32::GetOSName() if ON_WINDOWS; + # $os_details[3] is the minor version. return { bz_ver => BUGZILLA_VERSION, perl_ver => sprintf('%vd', $^V), @@ -582,11 +582,10 @@ sub set_output_encoding { return if grep(/^encoding/, @stdout_layers); my $encoding; - if (ON_WINDOWS and eval { require Win32::Console }) { + if (ON_WINDOWS) { # Although setlocale() works on Windows, it doesn't always return - # the current *console's* encoding. So we use OutputCP here instead, - # when we can. - $encoding = Win32::Console::OutputCP(); + # the current *console's* encoding. + $encoding = Win32::GetConsoleOutputCP(); } else { my $locale = setlocale(LC_CTYPE); @@ -643,9 +642,7 @@ sub prevent_windows_dialog_boxes { # during checksetup (since loading DBD::Oracle during checksetup when # Oracle isn't installed causes a scary popup and pauses checksetup). # - # Win32::API ships with ActiveState by default, though there could - # theoretically be a Windows installation without it, I suppose. - if (ON_WINDOWS and eval { require Win32::API }) { + if (ON_WINDOWS) { # Call kernel32.SetErrorMode with arguments that mean: # "The system does not display the critical-error-handler message box. # Instead, the system sends the error to the calling process." and diff --git a/Makefile.PL b/Makefile.PL index 3af1d58e5..cbe3c8a46 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -87,8 +87,11 @@ my %all_features = ( # Windows requires some additional modules. if ( $^O eq 'MSWin32' ) { - $requires{'Win32'} = '0.35'; - $requires{'Win32::API'} = '0.55'; + # 0.45 implements the GetConsoleOutputCP() method. + # It also supports Windows 7. Set this to 0.52 to support Windows 10. + $requires{'Win32'} = '0.45'; + # 0.63 fixes a problem with Strawberry Perl 5.14.1. + $requires{'Win32::API'} = '0.63'; $requires{'DateTime::TimeZone::Local::Win32'} = '1.64'; } -- cgit v1.2.3-24-g4f1b