- my $tree = shift;
-
-
-
- my %p = validate(
- @_, {
- table_ld => { default => ['_tag' => 'table'] },
- table_data => 1,
- table_proc => { default => undef },
-
- tr_ld => { default => ['_tag' => 'tr'] },
- tr_data => { default => sub { my ($self, $data) = @_;
- shift(@{$data}) ;
- }},
- tr_base_id => { default => undef },
- tr_proc => { default => sub {} },
- td_proc => 1,
- debug => {default => 0}
- }
- );
-
- warn "INPUT TO TABLE2: ", Dumper \@_ if $p{debug};
-
- warn "table_data: " . Dumper $p{table_data} if $p{debug} ;
-
- my $table = {};
-
- # use Data::Dumper; warn Dumper \%table;
-
- # ++$DEBUG if $table{debug} ;
-
- # Get the table element
- #warn 1;
- $table->{table_node} = ref_or_ld( $tree, $p{table_ld} ) ;
- #warn 2;
- $table->{table_node} or confess
- "table tag not found via " . Dumper($p{table_ld}) ;
-
- warn "table: " . $table->{table_node}->as_HTML if $p{debug};
-
-
- # Get the prototype tr element(s)
- my @proto_tr = ref_or_ld( $table->{table_node}, $p{tr_ld} ) ;
-
- warn "found " . @proto_tr . " iter nodes " if $p{debug};
-
- @proto_tr or return ;
-
- if ($p{debug}) {
- warn $_->as_HTML for @proto_tr;
- }
- my $proto_tr = List::Rotation::Cycle->new(@proto_tr);
-
- my $tr_parent = $proto_tr[0]->parent;
- warn "parent element of trs: " . $tr_parent->as_HTML if $p{debug};
-
- my $row_count;
-
- my @table_rows;
-
- {
- my $row = $p{tr_data}->($table, $p{table_data}, $row_count);
- warn "data row: " . Dumper $row if $p{debug};
- last unless defined $row;