#!/usr/bin/perl use LWP::Simple; use Time::Local; print "Content-type: text/html\n\n"; print < Metabuzz

EOT $googleurl = "http://www.google.com/press/zeitgeist.html"; $google = cachedget("cache/google", $googleurl); ($chunk) = ($google =~ m!Gaining Queries.*?
(.*?)

!s); while ($chunk =~ m!(\d+)\..*?>([^<]+)!gs) { $google[$1] = $2; } display ("Google", $googleurl, @google); print "\n"; $yahoourl = "http://buzz.yahoo.com/overall/"; $yahoo = cachedget("cache/yahoo", $yahoourl); while ($yahoo =~ m!(\d+).*?(.*?)!gis) { $yahoo[$1] = $2; } display("Yahoo", $yahoourl, @yahoo); print "\n"; $lycosurl = "http://50.lycos.com/"; $lycos = cachedget("cache/lycos", $lycosurl); while ($lycos =~ m!(\d+).*?([^<>]*)!gs) { $lycos[$1] = $2; } display ("Lycos", $lycosurl, @lycos); print "
"; print < EOT print ""; sub display { my ($site, $url, @listings) = @_; print ""; print ""; for ($i = 1; $i <= $#listings; $i++) { print "\n"; } print "

$site

$i$listings[$i]
\n"; } sub cachedget { ($file, $url) = @_; $filetime = timelocal(localtime((stat($file))[9])); $now = timelocal(localtime(time)); $filetime += (60 * 60 * 24); if ((-e $file) && ($filetime > $now)) { open (F, $file); my $foo = join("\n", ); close(F); return $foo; } $retval = get($url); open (F, ">$file"); print F $retval; close(F); return $retval; }