Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks who are always smarter than me. I am parsing html pages using Mojo::Dom and have certain instances where the class I'm looking for is not on the page and therefore causing a can't call method "text" on an undefined value error. Here's my code:
$r7=$dom->at ('[class="MTLgp 654"]')->text ;
I tried pushing it to an array using the following but no luck, error-ing out:
$r7=$dom->at ('[class="MTLgp 654"]')->each(sub {push @columns 101, joi +n '|', map { $_->text };
Any help is greatly appreciated. I think I'm close with how I'm trying to fix it but off for sure
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mojo Dom method "text" return undefined
by LanX (Saint) on Aug 31, 2021 at 01:41 UTC | |
by Anonymous Monk on Aug 31, 2021 at 03:56 UTC | |
|
Re: Mojo Dom method "text" return undefined (block eval { } )
by Anonymous Monk on Aug 31, 2021 at 07:51 UTC |