package ReportGen::RepFormat; use strict; require Exporter; use vars qw( $OFile @ISA @EXPORT ); @ISA = qw ( Exporter ); @EXPORT = qw ( $OFile &openReport &closeReport &openSection &closeSection ); use FileHandle; $OFile = undef(); my $SectionId = 0; my $SectionLevel = 0; sub openReport { my ($fname, $hname) = @_; die("$hname") if defined $OFile; # one report at a time $SectionId = 0; $SectionLevel = 0; $OFile = new FileHandle(">$fname"); die("$0: cannot create `$fname': $!\n") unless $OFile; warn("$0: creating: `$fname'\n"); my $html = <PolyReport: $hname

This page was created by the Report Generator tool, a part of the Web Polygraph benchmark.

HEADER print($OFile $html); } sub closeReport { print($OFile "

\n"); printf($OFile "Generated on %s by %s\n", scalar localtime(), join(' ', $0, @ARGV), ); print($OFile "\n"); undef $OFile; } sub openSection { my $title = shift; $SectionId++; print($OFile ""); printf($OFile "

$SectionId. $title

"); print($OFile "
\n"); $SectionLevel++; die($SectionLevel) if $SectionLevel != 1; # not yet supported } sub closeSection { die($SectionLevel) if $SectionLevel != 1; # not yet supported $SectionLevel--; } 1;