Perl gethostbyname

X

x

I'm trying to get Perl 5.8.7 working on z/OS. This nearly works but...
for some reason the inet_aton and gethostbyname calls are returning undef.

I guess that this means that I have to get involved in debugging the
internals. Does anyone know what C files lie at the heart of these
routines and what the best way to go about patching them is?

Ross
 
X

x

Purl said:
"nearly works" Please expand on your thought.

You need to provide your code in use.

Purl Gurl

By "nearly works" I meant that it passes most of the "make test" tests,
except for those related to unicode, which does not work on z/OS.

Here is a test script for gethostbyname:

use English;
use Socket;
use strict;

my ($host, $aliases, $addrtype, $length, @addrs) = gethostbyname
('ssa97.worldgroup.com');
print $host, "\n";
my ($a, $b, $c, $d) = unpack ('C4', $addrs[0]);
printf ("%d.%d.%d.%d\n", $a, $b, $c, $d);
exit 0;


Here is the correct output, from Perl 5.6.1:
ssa97.worldgroup.com
203.2.203.197

Here is what I get from Perl 5.8.7:

0.0.0.0



NB: Contrary to my original posrt, inet_aton is working OK.
 
X

x

Purl said:
Uh huh. Not surprising. Perl porters broke lots of code
out there adding unwarranted whistles and bells to perl.

I couldn't possibly draw such a conclusion. I just have a problem with
gethostbyname on one platform. I know that the same call works on other
platforms.

Try this, forwards or backwards:
#!perl

use Socket;

@Array = qw (google.com purlgurl.net);

foreach $host (@Array)
{
$ip_address = inet_ntoa (inet_aton($host));
print "$host : $ip_address\n";

$hostname = gethostbyaddr (inet_aton ($ip_address), AF_INET);
print "$ip_address : $hostname\n";
}

exit;


inet_ntoa works. However, the reverse lookup works for Perl 5.6.1 but
not 5.8.7

google.com : 216.239.57.99
216.239.57.99 :
purlgurl.net : 66.215.191.86
66.215.191.86 :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,266
Latest member
DavidaAlla

Latest Threads

Top