Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

HTML::Element Usage

by smitz (Chaplain)
on May 28, 2002 at 11:33 UTC ( [id://169738]=perlquestion: print w/replies, xml ) Need Help??

smitz has asked for the wisdom of the Perl Monks concerning the following question:

I've been messing about with WWW:Robot, crawling my local intranet, and (planning on) storing some title and meta tags in a DB. Getting WWW::Robot to work was a piece of cake, but the the only way it returns the contents of a page is in an HTML::Element object.
The question is: what the hell do I do with it? I swear I've gone through all the docs, but its a bit over my head to be honest. I just want some simple tags from the object, any ideas?

Thanks,
SMiTZ

Replies are listed 'Best First'.
Re: HTML::Element Usage
by Joost (Canon) on May 28, 2002 at 13:32 UTC
    The HTML::Tree and HTML::Element documentation seems to point to a lot of interesting info, you seem to need something like this:

    sub give_me_the_title { my $element = shift; # some HTML::Element my $title_element = $element->find_by_tag_name('title'); return $title_element->content_list(); }

    I haven't tried this and you really should take a longer look at the docs, it will be worth it in the long run - HTML parsers are complicated for a reason :-)

    If you really want to take a shot at making a quick hack, you could take a look at the HTML::Element->as_HTML() method.

    Hope this helps...

    -- Joost downtime n. The period during which a system is error-free and immune from user input.
•Re: HTML::Element Usage
by merlyn (Sage) on May 28, 2002 at 15:20 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://169738]
Approved by vek
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-25 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found