到了这里就跑不下去了,求助 connect(SOCK, $sin) || die "Connect: $!\n";
代码如下: use strict; package LIBS::IEGoogle; use Socket; our(@ISA, @EXPORT); sub doGoogleSearchWithIE; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(doGoogleSearchWithIE); use constant PORT => 9023; use constant DEFAULTCOUNT => 20; use constant DEFAULTPAGE => 0; use constant IP => '127.0.0.1'; use constant PROTO => 'tcp'; use constant PREFIX => 'http://www.google.com/search?'; sub doGoogleSearchWithIE { my ( $query, $startpage, $count, $port ) = @_; my $proto = getprotobyname(PROTO); my $AF_INET = 2; if( $port eq undef ) { $port = "PORT"; } my $sin = sockaddr_in($port,inet_aton(IP)); socket(SOCK, AF_INET, SOCK_STREAM, $proto) || die 'Socket: $!\n'; connect(SOCK, $sin) || die "Connect: $!\n"; select(SOCK); $| = 1; select (STDOUT); --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。 要在此论坛发帖,请发电子邮件到 [email protected] 要退订此论坛,请发邮件至 [email protected] 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛 -~----------~----~----~----~------~----~------~--~---
