#!perl -w
use strict;
use File::Find;
use CGI qw(:standard);
my $query = param("query");
print header();
print start_html();
print "\n
For the query $query, these results were found:
\n\n";
undef $/;
find( sub
{
return if($_ =~ /^\./);
return unless($_ =~ /\.html/i);
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 = $_;
if ($string =~ /(.*?)<\/title>/is)
{
$page_title = $1;
}
print "- $page_title
\n";
},
'/home/username/public_html');
print "
\n";
print end_html();