Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: (nrd) Hints & Tips on passing HTML?

by newrisedesigns (Curate)
on Feb 28, 2003 at 17:47 UTC ( #239493=note: print w/ replies, xml ) Need Help??


in reply to Hints & Tips on passing HTML?

If you are extracting information from pages with a similar format: HTML::TokeParser. Fetching the pages from a different server? Use LWP.

TokeParser easily strips out the text above:

#just to give you an idea about extracting text #not complete or tested while(my $token = $stream->get_token()){ if(($token->[0] eq 'S') && ($token->[1] eq 'td')){ my @tokens; my (@headers, @links); push(@tokens, $stream->get_token()) x 2; if(($tokens[0][0] eq 'S') && ($tokens[0][1] eq 'b')){ push(@headers, $tokens[1][1]); } if(($tokens[0][0] eq 'S') && ($tokens[0][1] eq 'a')){ push(@links, $tokens[0][2]{'href'}); } $stream->unget_token(@tokens); } }

When redisplaying that information, push it into a nice template using HTML::Template. Make it dynamic using CGI and the CGI module.

John J Reiser
newrisedesigns.com


Comment on Re: (nrd) Hints & Tips on passing HTML?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://239493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2015-07-07 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls