[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] , web clients in



>At 4:11 AM -0400 6/26/97, Nat Irons wrote:
>>O'Reilly recently published a book on writing web clients in perl.  anybody
>>know if it's any good?
>
>The book, "Web Client Programming in Perl", by Wong, is very good and makes
>provides a very thorough explanation of the HTTP protocol as well.
>
>>How much of it, if any, realistically applies to the mac?  Can one jury-rig
>>a telnet client in macperl for the purposes of bullying HTTP servers?
>
>Just about everything still applys, though you mak want to convert line
>argumnet inputs to Mac dialog boxes. The stuff on Tcl doesn't really apply
>for Tcl, but you can extrapolate for the Mac using the important code
>fragments. The Mac doesn't really need Tcl.
>
>
>-dhan

I'm reading Web Client Programming. I couldnt get the first example in the
book,
connecting to a web server, to work. I finally found something similar that
did work, which was....

sub Connect {
($sockaddr,$there,$response,$tries) = ("Snc4x8");
$there = pack($sockaddr,2,$port, &getaddress($hostname));
$proto = (getprotobyname ('tcp'))[2];
socket(S,AF_INET,SOCK_STREAM,$proto);
connect(S,$there);
}

sub getaddress {
  local($host) = @_;
  local(@ary);
  @ary = gethostbyname($host);
  return(unpack("C4",$ary[4]));
}

sub GetFile {
$file = "/";
select(S);
$|=1;
select(STDOUT);
print S "GET $file\r\n";
@line = <S>;
}

These subroutines will connect to a host and read the home page.
I don't know what the problem could have been with the first example
client in the O'Reilly book.

Polly Chase
pchase@publishingarts.com
>
>
>***** Want to unsubscribe from this list?
>***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch