Note that this script just does a couple of date translations in Perl
and redirects the browser to Google, altered query in tow.
It's just a regular query as far as Google is
concerned, so it doesn't require a
developer's API key.
This hack requires an additional module,
Time::JulianDay, and won't run
without it (http://search.cpan.org/search?query=Time%3A%3AJulianDay).
# Searches for recently indexed files on Google.
# Usage: goofresh.cgi is called as a CGI with form input,
# redirecting the browser to Google, altered query in tow.
use CGI qw/:standard/;
# Build a URL-escaped query.
(my $query = param('query')) =~ s#(\W)#sprintf("%%%02x", ord($1))#ge;
# How many days back?
my $days_back = int param('days_back') || 0;
# What's the current Julian date?
my $julian_date = int local_julian_day(time);
# Redirect the browser to Google with query in tow.
"+daterange%3A" . ($julian_date - $days_back) . "-$julian_date"