Skip Menu |
 

This queue is for tickets about the HTML-TableExtractor CPAN distribution.

Report information
The Basics
Id: 27336
Status: new
Priority: 0/
Queue: HTML-TableExtractor

People
Owner: Nobody in particular
Requestors: nalbion [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bug in column()
Date: Tue, 29 May 2007 13:04:10 -0700 (PDT)
To: bug-HTML-TableExtractor [...] rt.cpan.org
From: Nicholas Albion <nalbion [...] yahoo.com>
Download (untitled) / with headers
text/plain 1.5k
# I thought it was odd when I was trying to execute the following code # and it failed on the last line: my $te = HTML::TableExtract->new(); $te->parse($content); my $table = $te->first_table_found(); # my $lang = substr( $table->cell(1,0), 0, 5); # <-- This works. my @tabColum = table->column($table,0); # I've tried debugging the code, injecting some print"" statements # into the following code from the HTML::TableExtract module sub column { my $self = shift; my $c = shift; my @column; foreach my $row ($self->rows) { push(@column, $self->cell($row, $c)); } wantarray ? @column : \@column; } # I'm no perl expert, but my debug prints have helped me prove (to myself) # that the line "foreach my $row ($self->rows) {" associates $row with an ARRAY. # ...So is it okay to to call "$self->cell( ARRAY, INT )"? sub cell { my $self = shift; my($r, $c) = @_; my $row = $self->row($r); # <-- $r is an ARRAY! $c <= $#$row or croak "Column $c out of range ($#$row)\n"; $self->_cell_to_content($row->[$c]); } sub row { my $self = shift; my $r = shift; $r <= $#{$self->{grid}} # <-- $r is an ARRAY! or croak "row $r out of range ($#{$self->{grid}})\n"; my @ri = $self->row_indices; my @row = $self->_slice_and_normalize_row( $self->{grid}[($self->row_indices)[$r]] ); wantarray ? @row : \@row; } # ARRAY <= $#{$self->{grid}} --> "row ARRAY(0x1d53464) out of range (27)"


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.