Parsing user-defined tags for customized use.....

Moshiul Shovon (shovon@gte.com)
Mon, 05 Aug 1996 15:31:29 -0500


Hello there:

I have just installed Perl5.003 and the latest version of libwww-perl
(as of 08-02-96, how can I find out the version info of libwww-perl I am
using?). I am trying to learn perl and also use libwww-perl. I have a
c++ background.

I am a new perl programmer; lot of things are not quite clear yet
(syntax wise). I am trying to parse an HTML document to get the values
of some non-standard tags. I have no clue what I should do. I went
through the libwww cookbook (a set of examples I found with the docs),
but that was not enough for me. However, I believe I successfully
managed to use the UserAgent object.

I am not sure what I should use: HTML::Parse or HTML::Parser to parse
documents. The man page says I should use Parser. Can any one please
tell me where I can look at some examples? I need some pointers. Man
pages alone don't work for me, I need examples (beyond synopsis of the
man page!). 

Here is a typical test document that I need to parse:

<!Doctype HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
Test 1 This is Tag 1 This is Tag 2 The following is the code I have got so far: #! /usr/local/bin/perl $destURL="http://some.whe.re/some.html"; use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent("$0/0.1"); $req = new HTTP::Request 'GET', $destURL; $req->header('Accept' => 'teuse LWP::Text/html'); # send request $res = $ua->request($req); ### I am stuck here .... ### How do I Parse $res and find out the value (content) of MyTag1 and MyTag2? ### Thank you so much for your help. Cheers ... -- ========================================================================== Moshiul Shovon Technical Staff Member - Development & Integration GTE Laboratories Incorporated shovon@gte.com 2101 North Denton Drive 214-242-4515 Carrollton, TX 75006 ==========================================================================