Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 71062
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: DOUGDUDE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Win32::Registry not maintained
Hello, Currently this module's Win32 implementation uses the Win32::Registry module. This module has been marked deprecated and, at least for me (perl 5.12.3 64-bit) it will no longer even compile, which prevents this distribution from running. I have attached a patch here that will switch to Win32::TieRegistry which is mostly active. Some notes on the patch: The registry keys under HKLM need to be opened with explicit read-only access, as otherwise it defaults to read/write access and is denied on Windows 7 (see https://rt.cpan.org/Ticket/Display.html?id=57047).
Subject: 0001-Replace-Win32-Registry-with-Win32-TieRegistry.patch
From f70716ffe61093149d9bcf232dc8aa1e52e50161 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson <doug@somethingdoug.com> Date: Mon, 19 Sep 2011 01:15:58 -0400 Subject: [PATCH] Replace Win32::Registry with Win32::TieRegistry Win32::Registry is no longer maintained, and the module documentation itself is marked this way. Win32::Registry will no longer compile on certain Windows perls. --- Makefile.PL | 2 +- lib/Net/DNS/Resolver/Win32.pm | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 30e25f1..2f3681f 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -120,7 +120,7 @@ AMEN3 $Makefile{'PREREQ_PM'}->{'enum'} = 1.0; # Dependency for Win32::IPHelper $Makefile{'PREREQ_PM'}->{'Win32::IPHelper'} = 0.05; $Makefile{'PREREQ_PM'}->{'Win32::API'} = 0.55; - $Makefile{'PREREQ_PM'}->{'Win32::Registry'} = 0; + $Makefile{'PREREQ_PM'}->{'Win32::TieRegistry'} = 0; } diff --git a/lib/Net/DNS/Resolver/Win32.pm b/lib/Net/DNS/Resolver/Win32.pm index 80fdcec..94f6447 100644 --- a/lib/Net/DNS/Resolver/Win32.pm +++ b/lib/Net/DNS/Resolver/Win32.pm @@ -12,7 +12,7 @@ use Net::DNS::Resolver::Base (); $VERSION = (qw$LastChangedRevision: 795 $)[1]; use Win32::IPHelper; -use Win32::Registry; +use Win32::TieRegistry qw(KEY_READ REG_DWORD); use Data::Dumper; sub init { @@ -59,29 +59,28 @@ sub init { # The Win32::IPHelper does not return searchlist. Lets do a best effort attempt to get # a searchlist from the registry. - my ($resobj, %keys); + my $usedevolution = 0; - my $root = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'; - my $opened_registry =1; - unless ($main::HKEY_LOCAL_MACHINE->Open($root, $resobj)) { + my $root = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'; + my $reg_tcpip = $Registry->Open($root, {Access => KEY_READ}); + + if (!defined $reg_tcpip) { # Didn't work, maybe we are on 95/98/Me? - $root = 'SYSTEM\CurrentControlSet\Services\VxD\MSTCP'; - $main::HKEY_LOCAL_MACHINE->Open($root, $resobj) - or $opened_registry =0; + $root = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP'; + $reg_tcpip = $Registry->Open($root, {Access => KEY_READ}); } - - if ($opened_registry && $resobj->GetValues(\%keys)){ - $searchlist .= $keys{'SearchList'}->[2]; + if (defined $reg_tcpip){ + $searchlist .= $reg_tcpip->GetValue('SearchList'); + + my ($value, $type) = $reg_tcpip->GetValue('UseDomainNameDevolution'); + $usedevolution = defined $value && $type == REG_DWORD ? hex $value : 0; } - - - + if ($domain) { $defaults->{'domain'} = $domain; } - my $usedevolution = $keys{'UseDomainNameDevolution'}->[2]; if ($searchlist) { # fix devolution if configured, and simultaneously make sure no dups (but keep the order) my @a; -- 1.7.6.msysgit.0
Thanks Dougdude, I have your patch applied in trunk. It will be in the release that will follow shortly. -- Willem