Skip Menu |

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

Report information
The Basics
Id: 31582
Status: new
Priority: 0/
Queue: HTML-TableExtract

Owner: Nobody in particular
Requestors: auto218872 [...]

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

Subject: Problem with column($col) subroutine
Date: Sun, 16 Dec 2007 09:17:15 -0600
To: <bug-HTML-TableExtract [...]>
From: <auto218872 [...]>
Download (untitled) / with headers
text/plain 2.3k
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This issue affects HTML::TableExtract v2.10 on perl 5.8.8. Copied from perlmonks "HTTP::TableExtract woes" ( ==================== 'Ola, monks. I've been having a terrible time using HTML::TableExtract to extract a column from an HTML file using the 'column($col)' subroutine. I'm entirely baffled by this, so I've decided to throw in the towel and let some real professionals take a stab at it. No matter how I use 'column($cols)', I always get a 'row ARRAY(...) out of range (0)' message. I took a peak at the source for HTML::TableExtract, but couldn't determine what's going wrong. Could some benevolent monk show me the way? Relevant links, for the lazy: * HTML::TableExtract @ CPAN * HTML::TableExtract source #!/usr/bin/perl use HTML::TableExtract; use WWW::Mechanize; use Data::Dumper; use strict; use warnings; my $sensational = WWW::Mechanize->new( autocheck => 1 ); $sensational->get(''); chomp(my $html = $sensational->content); my $table = HTML::TableExtract->new(); $table->parse($html); #$table->tables_dump; my $t = $table->first_table_found; #print $t->cell(0,1); # works fine # each of these generate a 'row ARRAY(...) out of range (0)' message #print $t->column(1), "\n"; #print for $t->column(1); #print Dumper $t->column(1); $t->column(1); ==================== And a <a href="">reply</a> with a proposed patch: ==================== sub column { my $self = shift; my $c = shift; my @column; - - foreach my $row ($self->rows) { + foreach my $row (0..$#{$self->rows}) { push(@column, $self->cell($row, $c)); } wantarray ? @column : \@column; } Method rows() returns an anonymous array of rows (arrayrefs), but the cell method works with indices. ==================== -----BEGIN PGP SIGNATURE----- Note: This signature can be verified at Charset: UTF8 Version: Hush 2.5 wpwEAQECAAYFAkdlQXsACgkQzqQCDJ3lRA/3qgP9GZRLCvZAHKvSzgCktRgVcrwJbT8h mDw5G6tQJssEbt2MC3eNnjsvC35FEXGLDLpUk54huM9UkLYxaBu8forNQDA71ZJONDuk qT6Z1j+MIRYsfytf8wlAbyJxCKPkRFbinyLkigUiw0/I3J5X8KPWURurDGWqjfeKC1it 91jE2KY= =452W -----END PGP SIGNATURE----- -- Fast Computer Training. Click here.

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

Please report any issues with to