sub generate_report_html { my ($title, $columns, $data) = @_; print <<" EOF"; <html> <body> <center><img src='/original_logo_60pc.jpg'><p> <h2>${title} Report</h2></center> <p> <table width=100%> <tr> EOF foreach (@$columns) { print "<td><b><u>$_</u></b></td>"; } print "</tr>\n"; foreach my $row (@$data) { print "<tr>"; foreach (@$row) { print "<td>$_</td>"; } print "</tr>\n"; } print <<' EOF'; </table> </body> </html> EOF }
The code is called like:
my $columns = ["Col1", "Col2", "Col3", "Col4"]; my @data; while(...) { # Get data somehow push @data, ["$data1", "$data2", "$data3", "$data4"]; } generate_report_html("report title", $columns, [EMAIL PROTECTED]);
I want to be able to call it like:
my $columns = [{width => 150, text => 'Col1', total => 0}, {width => 100, text => 'Col2', total => 1}, {width => 200, text => 'Col3', total => 1}, {width => 100, text => 'Col4', total => 0}]; my @data; while(...) { # Get data somehow push @data, ["$data1", "$data2", "$data3", "$data4"]; } generate_report_html("report title", $columns, [EMAIL PROTECTED]);
Can anyone offer any suggestions?
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>