re: Errors on wwwhttp.pl

Paul Schinder (schinder@pjstoaster.pg.md.us)
Tue, 23 Jan 96 10:59:28 -0500


val@citi.doc.ca writes:
} I'am using   wwwhttp.pl,v 0.15 1994/09/21  with MacPerl 5.0.51rm and I am
} getting the error
} 
}         # Undefined subroutine &main::AF_INET called.
}         File 'path:wwwhttp.pl'; Line 106
} 
} The actual line 106 is
} 
}         $that = pack('S n a4 x8', &main'AF_INET, $port, $thataddr);
} 
} I have socket.pl in the lib and  AF_INET is there.  The program which calls
} all this
} is a very short test
} 
} 
} require "www.pl";
}  local($content) = '';
}  local($headers) = '';
}  local(%headers) = ();
} $method ='HEAD';
} $url = 'http://macval.citi.doc.ca/';
} $timeout = '90';
}  $respcode = &www'request($method, $url, *headers, *content, $timeout);
} print "$respcode $content";
} 
} Have anybody a hint ?

My guess is that whatever socket.pl MacPerl is finding (it may not be
the one you think it is) doesn't put AF_INET into main's namespace.
AF_INET is just 2, so you can simply replace &main'AF_INET with 2 and
that line should work.  When I ported libwww-perl-0.40 to the Mac,
since I didn't have socket.pl handy I simply replaced it with the
equivalents from the Grand Unified Sockets Interface file GUSI.ph that
Matthias Neeracher, MacPerl's author, provides.  You can simply require
"GUSI.ph" and use &GUSI'AF_INET.  My wwwhttp.pl and the rest of the
libwww-perl-0.40 Macintosh port works under MacPerl 5.05, and if you
want it, you can grab it by following the links on my MacPerl page
<http://mors.gsfc.nasa.gov/>

} Alex
} val@citi.doc.ca
} 
} 
} 
---
--------
Paul J. Schinder
NASA Goddard Space Flight Center,
Code 693, Greenbelt, MD 20771 USA
schinder@pjstoaster.pg.md.us