1 package PciIds::Html::Format;
4 use PciIds::Html::Util;
7 our @EXPORT = qw(&htmlFormatTable);
9 sub htmlFormatTable( $$$$$$ ) {
10 my( $data, $cols, $headers, $funcs, $filter, $trHead ) = @_;
11 $trHead = sub { return ''; } unless( defined $trHead );
12 foreach my $line ( @{$data} ) {
13 next unless( &{$filter}( $line ) );
15 print '<tr'.&{$trHead}( $line ).'>';
16 for( $i = 0; $i < $cols; $i ++ ) {
18 if( ( scalar( @{$headers} ) > $i ) && defined( $headers->[ $i ] ) ) {
19 $header = $headers->[ $i ];
23 if( ( scalar( @{$funcs} ) > $i ) && defined( $funcs->[ $i ] ) ) {
24 $func = $funcs->[ $i ];
28 my $data = &{$func}( $line->[ $i ] );
29 $data = "" unless( defined( $data ) );