[Omaha.pm] Help with parsing HTML

Ryan Stille rps at willcomminc.com
Wed Sep 28 10:00:55 PDT 2005


> Really, please go look at how it's done in WWW::Mechanize
> with HTML::Parser.  Once you get your head around callbacks, it's
> super simple. 

Ok I am getting closer.  The problem is it is is ignoring nested tags.

File:
<CFQUERY>
Blah blah <CFQUERYPARAM arg1=value1 etc> AND blah blah
</CFQUERY>

My Code:
  my $p = HTML::TokeParser->new($arg) or die $!;

  while ($p->get_tag("cfquery")) {
    my $query = $p->get_trimmed_text("/cfquery");
    print "$arg: $query\n";
    }

Returns:
Blah blah AND blah blah

How do I tell it to leave the tags in there?

-Ryan



More information about the Omaha-pm mailing list