#!/usr/local/bin/perl5_8
use strict;
use ncw_com_library; # contains common subs (commify, timeout, etc.)
use HTML::Template;
use Time::Local;
use DBI;
use CGI ':standard';
my $CGI = CGI->new;
# Clear buffers and set up web page (required)
$|=1;
open STDERR, ">&STDOUT";
# SNIP there are ~25,000 unique keys in my control table and I have snipped
# out the SQL and database calls that generate my control table dataset for
# those since they are returning results in a timely fashion based on
# timestamps printed while fetching and executing SQL.
my ($key, %col_cbud, %col_encu, %col_fytd, %col_proj, %ctrl_tbl, @loop_data);
foreach $key ( sort keys %ctrl_tbl )
{ my %row_data;
# Gimme a timestamp so I can see how long each row takes
my ( $sec1,$min1,$hour1,$mday1,$mon1,$year1,$wday1,$yday1,$isdst1 ) = localtime;
print "during foreach loop hour min sec $hour1 $min1 $sec1 xxx key is $key
";
$row_data{col_proj} = $key;
$row_data{col_cbud} = $col_cbud{$key};
$row_data{col_fytd} = $col_fytd{$key};
$row_data{col_encu} = $col_encu{$key};
# Add each hash row to loop for template
push(@loop_data, \%row_data);
}
# Pass parameters and variable values from @loop arrays to template; print report
$template->param(
passdata => \@loop_data,
);
print $template->output();
####
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbefore foreach loop hour min sec 11 13 44
during foreach loop hour min sec 11 13 45 xxx key is 649001
during foreach loop hour min sec 11 14 43 xxx key is 649001-60426-F
SNIP
during foreach loop hour min sec 12 3 44 xxx key is 660062-05279
during foreach loop hour min sec 12 4 19 xxx key is 660062-15279