cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
I am using HTML::TreeBuilder to parse HTML for the purposes of extracting information on some web pages, using HTML::Element to do this. When I do something like my $d = $tree->look_down('class','date'); the hash I get back has a {_content} array with the values I want.
The docs describe keys beginning with underscore as "internal attributes," which I suppose means I'm not supposed to access the directly, but I can and do. For example my $date = $d->{_content}->[1]
But I'm wondering if there is a more proper construction for this. For example, in LWP::UserAgent you can get $response->status_line which I think accesses an internal attribute. In the date example my $date = $d->content[1] doesn't work. I've searched around and have not been able to find an answer.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Element accessing "internal attributes" the proper way
by jcb (Parson) on Dec 25, 2020 at 03:27 UTC | |
by LanX (Saint) on Dec 25, 2020 at 06:55 UTC | |
by jcb (Parson) on Dec 26, 2020 at 01:30 UTC | |
by LanX (Saint) on Dec 26, 2020 at 02:54 UTC | |
|
Re: HTML::Element accessing "internal attributes" the proper way
by Anonymous Monk on Dec 25, 2020 at 01:44 UTC | |
by cormanaz (Deacon) on Dec 25, 2020 at 16:34 UTC |