#!/usr/bin/perl # Read in the KT XML and turn it into a bunch of smaller pages. This perhaps should use a perl XML # muncher? use strict; use CGI; my($INPUT, $result, $section, $scount, $dumping); $result = new CGI(); print $result->header(); # The start of the page print "Kernel Traffic : "; if($result->param('page') eq ""){ print "Main Page"; } else{ print "Page ".$result->param('page'); } print "\n"; # Links we always have if($result->param('page') eq ""){ print "Statistics
\n"; } $section = 0; $scount = 1; $dumping = 0; open INPUT, "wget -q -O - http://kt.zork.net/kernel-traffic/latest.xml |"; while(){ if($result->param('page') eq ""){ if(/^section/){ $section = 1; } elsif(($section = 1) && (/^[ \t]+title=\"(.*)\"/)){ print "
  • $1
    \n"; $scount++; $section = 0; } else{ $section = 0; } } elsif($result->param('page') eq "stats"){ if(/^\n"; } } # The page must be a section number to aim at... else{ if(/^
    param('page')){ if(/^[ \t]*title=\"(.*)\"/){ print "$1
    \n"; } elsif(/^[ \t]*subject=\"(.*)\"/){ print "($1)
    \n"; } elsif(/^[ \t]*startdate=\"(.*)\"/){ print "Start: $1
    \n"; } elsif(/^[ \t]*enddate=\"(.*)\"/){ print "End: $1
    \n"; } elsif(/^>/){ print "
    \n"; $dumping = 1; } elsif(/^<\/section>/){ $dumping = 0; } elsif($dumping == 1){ print $_; } } } } print "\n";