#!/usr/bin/perl -w # acts as index.pl to a directory of text files named by whitespace delineated tags. # query string searches print "Content-type: text/html\n\n"; print ""; $s = $ENV{QUERY_STRING}; $num_recent = "5"; $rss_on = "yes"; foreach $file (<*> ) { if($file ne "$rss" && $file ne "index.pl") { push(@filelist, $file); $new = (stat($file))[9]; push(@filemlist,"$new|$file") } } if ($s) { foreach $file(@filelist) { if ($file =~ /$s/) { push(@foundfiles, $file); ($ffile = $file) =~ s/ /%20/g; print "[$file]
"; } } print "
back"; print "
";
 foreach $file(@foundfiles) {
  ($ffile = $file) =~ s/ /%20/g;
  print "[$file]

"; open (F, "$file"); while ($_ = ) { print $_; } close F; print "

"; } print "
"; die; } if ($rss_on eq "yes") { print "RSS

"; } @tags = (); foreach $file(@filelist) { @words = split(/ /,$file); foreach $word(@words) { push(@tags, $word); } } %seen = (); foreach $tag(@tags) { push(@uniq, $tag) unless $seen{$tag}++; } @sortuniq = sort{lc($a) cmp lc($b)} @uniq; foreach $tag(@sortuniq) { print "$tag
"; } unless ($num_recent == 0) { print "last $num_recent whatevers

"; } @sorted = reverse sort{$a <=> $b} @filemlist; @sorted = @sorted[0..--$num_recent]; foreach $recent(@sorted) { @rec = split(/\|/, $recent); ($rrec = $rec[1]) =~ s/ /$20/g; print "@rec[1]
";
 open (G, "$rec[1]");
 while ($_ = ) { 
  print $_;
 }
 close G;
 print "


"; } print "
";