G'day mcoblentz,

"I am getting a basic error: Can't call method "rows" on an undefined value ..."

The only code you show with that method (i.e. the point where the error occurs) is:

foreach my $row ($te->rows) {

Some lines earlier in your code you declare $te:

my $te;

At the point of declaration it will have "an undefined value". At the point where the error occurs it has "an undefined value". Track its value through the code between those two points to find where it's being directly assigned undef or its value is being changed to undef through a side-effect. You'll now have a narrow focus for your troubleshooting efforts.

"I have tried dumping the table but I don't understand the results from Dumper."

You haven't shown this output, or even given a hint as to what part you don't understand, so I'm not sure what you think we can do about that. Perhaps the Data::Dumper documentation will help.

Your code shows other print statements. At least one of those probably had some output: you don't show that either.

I recommend you take a look at perlobj: Invoking Class Methods. Read the section "Indirect Object Syntax"; noting its first paragraph, which is all in bold, and includes the text:

"..., use of this syntax is discouraged as it can confuse the Perl interpreter. ..."

Please follow this advice and change your code accordingly.

-- Ken


In reply to Re: Table scraping by kcott
in thread Table scraping by mcoblentz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.