\n";
print "
\n";
print "
Search Results
\n";
print "\n
For the query '$query', these results were found:
\n
\n";
undef $/;
find( sub
{
return if($_ =~ /^\./); # parse out files that start with a '.'
return if($_ =~ /^\index.html/); # parse out archives index.html
return if($_ =~ /^200/); # parse out monthly archives
return unless($_ =~ /\.html/i); # get only .html files
stat $File::Find::name;
return if -d;
return unless -r;
open(FILE, "< $File::Find::name") or return;
my $string = ;
close (FILE);
return unless ($string =~ /\Q$query\E/i);
my $page_title = $_;
# get page title for result
if ($string =~ /Blogzilla - a blog about Mozilla: (.*?)<\/title>/is)
{
$page_title = $1;
}
# getting proper link for filename because alistapart example didn't work properly
my $filename = $File::Find::name;
my $extract_filename = $_;
if ($filename =~ /\$filepath(.*?)/is)
{
$extract_filename = $1;
}
print "- $page_title
\n";
}, $filepath);
print "
\n";
print "
Search
\n";
print "
\n";
print end_html();