# for the sake of brevity, I'll include just the relavent code
# here's how I open the files to begin with.
my @incHandles = (*INCNT, *INCMAIL, *INCUNIX);
my $filepath = "/opt/apache/htdocs/nbu/reports";
open $incHandles[0], ">$filepath/inc.nt" or die "cannot open $filepath/inc.nt for writing: $!\n";
open $incHandles[1], ">$filepath/inc.mail" or die "cannot open $filepath/inc.mail for writing: $!\n";
open $incHandles[2], ">$filepath/inc.unix" or die "cannot open $filepath/inc.unix for writing: $!\n";
# then, as I iterate through a couple of hashes,
# amongst other things, I call the following two subs
##################################################################
sub printTableRow {
my ( $outHandle, $status, $class, $incFlag ) = @_;
# Hash of colors
my %colors = ( active => "#005154",
failed => "#ff0000",
queued => "#622188",
partial => "#ffb90f",
success => "#00ff00"
);
# Hash of titles
my %titles = ( active => "Active Jobs",
failed => "Failed Jobs",
queued => "Queued Jobs",
partial => "Partially Successful Jobs",
success => "Successful Jobs"
);
$incString = "$class
";
my $incHandle;
if ( $incFlag eq "N" ) { $incHandle = *INCnt; }
if ( $incFlag eq "M" ) { $incHandle = *INCmail; }
if ( $incFlag eq "U" ) { $incHandle = *INCunix; }
push ( @{$anchors{$incHandle}{$status}}, $incString );
#if ( $incFlag eq "N" ) { print INCnt "$incString\n"; }
#if ( $incFlag eq "M" ) { print INCmail "$incString\n"; }
#if ( $incFlag eq "U" ) { print INCunix "$incString\n"; }
print $outHandle <\n
|
$class: $titles{$status}
|
ROW
}
##################################################################
# print include files for SSI
sub printIncludes {
my ( $incHandle, $status );
for $incHandle ( keys %anchors ) {
for $status ( keys %{ $anchors{$incHandle}} ) {
print $incHandle "@{ $anchors{$incHandle}{$status} }\n";
}
}
}
##################################################################