Can't open $url, ret = $!
\n"; $openfailed = 1; } eval { # while loop がタイムアウトしたら例外を投げる alarm($timeout); while () { if ($_ =~ /.+Last\-[Mm]odified\: (...), (..) (...) (....) (..):(..):(..) GMT/) { @gmlm = ($7, $6, $5, $2, $month{$3}, $4 - 1900); $lastmodnew = &timegm(@gmlm); # print "-1, $lastmodnew\n"; if ($lastmodnew != $lastmod) { # 更新時刻が変わっていたら # print "$lastmod changed.\n"; $lastmod = $lastmodnew; } @lm = localtime($lastmod); last; } else { # print "-1, no match to Last-Modified line.\n"; } } alarm(0); }; if ($@) { if ($@ =~ /timeout/) { print "timeout of HEAD request: $url
\n"; $openfailed = 1; kill 9 => $pidhead; } else { alarm(0); kill 9 => $pidhead; die; } } if (kill 0 => $pidhead) { kill 9 => $pidhead; } close HEAD; } elsif ($bytes <= -2) { ## RDF があれば dc:date を読む $skipdcdate = -2 - $bytes; # dc:date 読み飛ばし if (!($pidhead = open(RDF, "$wgetpath $url -O - -q -T $timeout -U $useragent |"))) { die "Can't open $url, ret = $!
\n"; $openfailed = 1; } eval { # while loop がタイムアウトしたら例外を投げる alarm($timeout); while (timeout of GET request: $url
\n"; $openfailed = 1; kill 9 => $pidhead; } else { alarm(0); kill 9 => $pidhead; die; } } if (kill 0 => $pidhead) { kill 9 => $pidhead; } close RDF; } else { ## Last-Modified を返さないサイトは GET でソース取得 if (!($pidget = open(GET, "$wgetpath -O - -q $url -T $timeout | "))) { die "Can't open $url, ret = $!
\n"; $openfailed = 1; } eval { alarm($timeout); $newbytes = read(GET, $getsource, $getsourcemax); alarm(0); }; if ($@) { if ($@ =~ /timeout/) { print "timeout of GET request: $url.
\n"; $openfailed = 1; kill 9 => $pidget; } else { alarm(0); kill 9 => $pidget; die; } } if ($newbytes != 0 && $newbytes != $bytes) { # byte 数が変わっていたら $bytes = $newbytes; $lastmod = $nowtime; } if (kill 0 => $pidget) { # プロセス $pidget が生きていたら殺す kill 9 => $pidget; } close GET; } push(@array, "$lastmod" . " $url" . " $bytes" . " $openfailed"); } close CACHEIN; ### 更新時刻取得にかかった時間を求める $endtime = time; $elapsetime = $endtime - $nowtime; ### diary.dat を開いて、「サイトURL -> (名前, アンカー)」の連想配列を作る open(DIARYDAT, $diarydat) || print "can't open $diarydat\n"; $/ = ""; # 入力セパレータを空文字列にする while (
$nowtimestr
Elapsed time for survey: $elapsetime sec.
Number of sites: $sites
$koushin | $hotpathos |
$yabai | $coolpathos |
$majiyabai | $coldpathos |
$lastmodstr$lmcl | $sitehash{$site} |