#!/usr/bin/perl use CGI ':standard'; use strict; use warnings; use CGI::Carp 'fatalsToBrowser'; # use only for testing my @cols = qw(TIME CATEGORY Sender Recipients Quarantined-ID); my $table = ''; $table .= join '',map{""}@cols; $table .= ''; #open FILE, '<', '/tmp/quarantine.ok' or die $!; #while() { while (){ chomp; next unless /\S/; # skip blank lines my @f = split ; my $date = join ' ',@f[0..2]; my $color = ($f[3] eq 'INFECTED') ? '#ffcccc' : '#ffffff'; $table .= qq!!; $table .= join '',map{""}$date,@f[3..6]; $table .= ""; } #close FILE; $table .= '
$_
$_
'; print header,start_html('Page Title'); print h1("Heading"); print $table; print end_html; __DATA__ May 3 15:58:17 SPAM sender@domain.com peter.w@recipient.com spam-Lub_LynRmcvj.gz May 3 15:58:24 SPAM sender@domain1.com coev074@recipient1.com spam-gSCAdAuMpiD0.gz May 3 15:59:27 BANNED sender@domain2.com nadia.meli@grecipient2.com banned-BpF8aM7FM48B May 3 16:00:29 SPAM sender@domain.com sascha_ste@recipient.com spam-6fFrrzUjgvug.gz May 3 16:01:48 INFECTED sender@domain3.com philipp_me@recipient.com virus-SZLvi-VO4IIv May 4 16:02:28 SPAM sender@domain.com caro.grill@recipient3.com spam-saYzvikxOfVL.gz May 4 16:02:45 SPAM sender@domain.com pellitter@recipient.com spam-8K649OHNlRQ2.gz May 4 16:03:14 SPAM sender@domain1.com anton.d@recipient.com spam-3rpUGn3IcDnG.gz