OfficeLinebacker has asked for the wisdom of the Perl Monks concerning the following question:
I get this...esoteric? error: Can't bless non-reference value at C:/Perl64/site/lib/HTML/ElementTable.pm line 431. With the following code:
I tried taking out the qw(tree) in the use HTML::TableExtract line.#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use WWW::Mechanize; use Readonly; use HTML::TreeBuilder; #use HTML::Element qw(Table); #use HTML::TableExtract qw(tree); use HTML::TableExtract; use HTML::Encoding 'encoding_from_http_message'; use Encode; use File::Slurp; Readonly::Scalar my $url => 'http://www.emarketplace.state.pa.us/Searc +h.aspx'; my $mech = WWW::Mechanize->new( agent => 'Mozilla/5.0 (Windows NT 6.1; + WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2' ); $mech->get($url); #There is only one form on the page and they start at 1 in WWW:Mechani +ze my $form = $mech->form_number(1); # 'wucSearch$btnSearch' is the NAME of the button we want to press; 'w +ucSearch_btnSearch' is the id # 'wucSearchResults$ddlRows' is the NAME of the input item we want to +set to 'ALL' $mech->select('wucSearchResults$ddlRows','ALL'); my $response = $mech->click_button(name => 'wucSearch$btnSearch'); if ($response->is_success) { #print $response->decoded_content; # or whatever } else { die $response->status_line; } my $HTML = $response->decoded_content; #my $te = HTML::TableExtract->new(slice_columns=> 0, keep_html => 1);# +, headers => ["Solicitation#"]); my $te = HTML::TableExtract->new(); $te->parse($HTML);
I see one other node about a similar error: Net::Packet::Dump can't bless non-reference as 'IO::File' but I don't really see how this would apply to me.
Without further ado, how do I fix this? Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Can't bless non-reference value" error with HTML::TableExtract
by Perlbotics (Archbishop) on Sep 16, 2011 at 22:56 UTC | |
by OfficeLinebacker (Chaplain) on Sep 29, 2011 at 12:49 UTC |