OfficeLinebacker has asked for the wisdom of the Perl Monks concerning the following question:
After a long time away, I'm using Perl again. I'm having an odd error I can't figure out with my program and I don't see anything about it in the other HTML:TableExtract threads. Basically, whenever I enable keep_html in my constructor, I get a series of these warnings. I've looked through the module code but I don't really get what's going on. How do I fix it? Without further ado, my code:
Output:#!/usr/bin/perl -w use strict; use LWP::UserAgent; use Readonly; use HTML::TreeBuilder; use HTML::TableExtract; use HTML::Encoding 'encoding_from_http_message'; use Encode; Readonly::Scalar my $url => 'https://ebidmarketplace.com/publicVenSolL +ist.asp'; Readonly::Scalar my $params1 => '?selAgency=&selbuyercd=&mDueDateFrom= +&mDueDateTo=&docno=&fiscalyr=&chgordseq=&Agency=&buyerCode=&'; Readonly::Scalar my $params2 => 'agencyName=&buyerName=&selShowRows=99 +99&selsortby=POST_DATE&mStatus=0&changeind=01&curPage=1'; Readonly::Scalar my $fullurl => $url.$params1.$params2; # POST /publicVenSolList.asp selAgency=&selbuyercd=&mDueDateFrom=08%2F +04%2F2011&mDueDateTo=09%2F03%2F2011&docno=&fiscalyr=&chgordseq=&Agenc +y=&buyerCode=&agencyName=&buyerName=&selShowRows=500&selsortby=DUE_DA +TE&mStatus=0&changeind=01&curPage=1 my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get($fullurl); if ($response->is_success) { #print $response->decoded_content; # or whatever } else { die $response->status_line; } #my $te = HTML::TableExtract->new(keep_html => 1, keep_headers => 1, +slice_columns=> 0, strip_html_on_match => 1, headers => ["Solicitatio +n#"], debug => 9); my $te = HTML::TableExtract->new(keep_headers => 1, slice_columns=> 0 +, keep_html => 1, headers => ["Solicitation#"]); #my $te = HTML::TableExtract->new(); print "before parse\n"; $te->parse($response->decoded_content); print "after parse\n"; # Examine all matching tables foreach my $ts ($te->tables) { print "Table found at ", join(',', $ts->coords), ":\n"; print "Table (", join(',', $ts->coords), "):\n"; my $i=0; foreach my $row ($ts->rows) { $i++; if ($row->[0]){ #print join(',', @$row), "\n"; }else{ print "Row variable is empty at row $i\n"; } } }
I can make the warning go away by taking out the "keep_html => 1," part of the constructor. The program does work. Thanks!Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. Use of uninitialized value in subroutine entry at C:/Perl64/site/lib/H +TML/TableExtract.pm line 1229. before parse after parse Table found at 1,5: Table (1,5):
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Use of uninitialized value in subroutine entry" warning with HTML::TableExtract
by Anonymous Monk on Aug 05, 2011 at 13:40 UTC | |
by OfficeLinebacker (Chaplain) on Aug 05, 2011 at 14:08 UTC | |
by Anonymous Monk on Aug 05, 2011 at 14:20 UTC | |
by afoken (Chancellor) on Aug 07, 2011 at 12:40 UTC | |
by Anonymous Monk on Aug 07, 2011 at 13:00 UTC | |
by OfficeLinebacker (Chaplain) on Sep 29, 2011 at 12:45 UTC |