Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Valid CPAN distribution.

Report information
The Basics
Id: 1470
Status: resolved
Priority: 0/
Queue: Email-Valid

People
Owner: Nobody in particular
Requestors: chromatic [...] wgz.org
Cc:
AdminCc:

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



Subject: Improve nslookup location on Windows
When running Email::Valid on a Windows machine, the module would often fail in attempting to resolve a hostname. It could not find the 'nslookup' binary. The attached patch was the quickest and most obvious platform-independent approach that came to mind.
--- Valid.pm~ Fri Aug 2 11:30:44 2002 +++ Valid.pm Fri Aug 2 11:39:41 2002 @@ -7,12 +7,13 @@ use Carp; use IO::File; use Mail::Address; +use File::Spec; $VERSION = '0.14'; %AUTOLOAD = ( mxcheck => 1, fudge => 1, fqdn => 1, local_rules => 1 ); $NSLOOKUP_PAT = 'preference|serial|expire|mail\s+exchanger'; -@NSLOOKUP_PATHS = qw( /usr/bin /usr/sbin /bin ); +@NSLOOKUP_PATHS = File::Spec->path(); $DNS_Method = ''; sub new { @@ -90,8 +92,11 @@ sub _find_nslookup { my $self = shift; + my $ns = 'nslookup'; + $ns .= '.exe' if $^O =~ /win32/i; foreach my $path (@NSLOOKUP_PATHS) { - return "$path/nslookup" if -x "$path/nslookup" and !-d _; + my $file = File::Spec->catfile( $path, $ns ); + return $file if -x $file and !-d _; } return undef; }
From: muenalan [...] cpan.org
[CHROMATIC - Sat Aug 24 16:41:02 2002]: thats what the user sees... [perl5.8.0/win32] CPAN.pm: Going to build M/MA/MAURICE/Email-Valid-0.14.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Email::Valid Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cp Valid.pm blib\lib\Email\Valid.pm w:\bin\nmake -- OK Running make test Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. C:\Programme\Perl\bin\perl.exe "-MExtUtils::Command::MM" "- e" "test_harness(0, 'blib\lib', 'blib\arch')" t\valid.t t\valid....ok 8/10unable to locate nslookup at t\valid.t line 46 t\valid....dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 9-10 Failed 2/10 tests, 80.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed ----------------------------------------------------------------------- -------- t\valid.t 255 65280 10 4 40.00% 9-10 Failed 1/1 test scripts, 0.00% okay. 2/10 subtests failed, 80.00% okay. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2' Stop. w:\bin\nmake test -- NOT OK Running make install make test had returned bad status, won't install without force
Subject: [PATCH FAILES] Improve nslookup location on Windows
From: muenalan [...] cpan.org
[CHROMATIC - Sat Aug 24 16:41:02 2002]: after applying the patch it doesn't work. --- V:\.cpan\build\Email-Valid-0.14>patch Valid.pm --- Valid.pm~ Fri Aug 2 11:30:44 2002 +++ Valid.pm Fri Aug 2 11:39:41 2002 @@ -7,12 +7,13 @@ use Carp; use IO::File; use Mail::Address; +use File::Spec; $VERSION = '0.14'; %AUTOLOAD = ( mxcheck => 1, fudge => 1, fqdn => 1, local_rules => 1 ); $NSLOOKUP_PAT = 'preference|serial|expire|mail\s+exchanger'; -@NSLOOKUP_PATHS = qw( /usr/bin /usr/sbin /bin ); +@NSLOOKUP_PATHS = File::Spec->path(); $DNS_Method = ''; sub new { @@ -90,8 +92,11 @@ sub _find_nslookup { my $self = shift; + my $ns = 'nslookup'; + $ns .= '.exe' if $^O =~ /win32/i; foreach my $path (@NSLOOKUP_PATHS) { - return "$path/nslookup" if -x "$path/nslookup" and !-d _; + my $file = File::Spec->catfile( $path, $ns ); + return $file if -x $file and !-d _; } return undef; } patching file Valid.pm V:\.cpan\build\Email-Valid-0.14>modinst Installing perl extension Checking if your kit is complete... Looks good Writing Makefile for Email::Valid Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. cp Valid.pm blib\lib\Email\Valid.pm C:\Programme\Perl\bin\perl.exe "-MExtUtils::Command::MM" "- e" "test_harness(0, 'blib\lib', 'blib\arch')" t\valid.t t\valid....ok 9/10Der Befehl "-" ist entweder falsch geschrieben oder konnte nicht gefunden werden. t\valid....ok All tests successful. Files=1, Tests=10, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU)