I need to find a way to get HTML::Parser return the text between the tag
caught by the start_h handler and the related closing tag.  Could
someone please point me in the right direction?

Cut down code thus far:

#!/usr/bin/perl -wT
use strict;
use HTML::Parser;

my %choices;
my $file = 'test_snippet';
my $parser = HTML::Parser-> new(api_version => 3,
        start_h => [\&start, "tagname, attr, "],
        ); # I think I need to add something after attr, to get
        # what I want, but not sure what to add

sub start {
        my ($tag, $attr, $tagged_text) = @_; # $tagged_text should get
        # whatever we pass after attr in start_h
        print "we got: $tag\t$attr\t$tagged_text\n";
        for (keys %{$attr}){
                my $value = (${$attr}{$_});
                # do something with $tagged_text if we had it
        }
}
$parser->parse_file($file) or die "couldn't parse file";
## end

Thanks,
Tim Bowden (fighting back against the stupid stick)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to