### Output Loop. Sub Routine to generate Web Output to ActiveWindow sub webpage_output { while(1) { if ( -e $Statfile ){ open(ACTWIN,">$ActiveWindow") || die "Couldn't open file $ActiveWindow - $!\n"; print ACTWIN "Transid|Datestamp|Timestamp|Ticket|PagerId|Message|Status\n"; ### ### changed method of opening getting the last files in the directory ### also changed sort order to display on screen ### April 5, 2004 opendir(CacheDir,$Cache) || die "Couldn't open the directory $Cache: $!\n"; @filelist=grep { /[0-9]{5}/ } readdir(CacheDir); closedir(CacheDir); @sortlist=sort {$b <=> $a} @filelist; for ($i=0;$i<$MsgCount;$i++) { $filename=$sortlist[$i]; if ($filename) { open(ITEM,"$Cache/$filename"); while(){ chomp; if(/TransID=(.*)/){$a=$1;} if(/DATE=(.*)/){$b=$1;} if(/TIME=(.*)/){$c=$1;} if(/TICKET=(.*)/){$d=$1;} if(/PagerID=(.*)/){$e=$1;} if(/Message=(.*)/) { $f=$1; $cont="Y"; next; } if(/Status=(.*)/){$g=$1; $cont="";next;} if ($cont eq "Y") { $f=$f.$_; } } close(ITEM); print ACTWIN "$a|$b|$c|$d|$e|$f|$g\n"; } } close(ACTWIN); unlink($Statfile) || die "Couldn't delete $Statfile - $!\n"; } sleep($naptime); } }