develooper Front page | perl.libwww | Postings from December 2000

Ambiguous use of text => resolved to "text"

Thread Next
From:
Jose Quesada
Date:
December 14, 2000 23:31
Subject:
Ambiguous use of text => resolved to "text"
Message ID:
3A39CBFB.27447D60@psych.colorado.edu
Hi,

I'm playing around with Parse::HTML, and using one of the examples,
I get the next error:

    Ambiguous use of text => resolved to "text" at line 26

Here is the code, line 26 is marked with #######
!/usr/bin/perl -w
# Extract all plain text from an HTML file

use strict;
use HTML::Parser 3.00 ();

my %inside;

sub tag
{
   my($tag, $num) = @_;
   $inside{$tag} += $num;
   print " ";  # not for all tags
}

sub text
{
    return if $inside{script} || $inside{style};
    print $_[0];
}

HTML::Parser->new(api_version => 3,
    handlers    => [start => [\&tag, "tagname, '+1'"],
      end   => [\&tag, "tagname, '-1'"],
      text  => [\&text, "dtext"], ############
     ],
    marked_sections => 1,
 )->parse_file(shift) || die "Can't open file: $!\n";;

The script works, but I'm terribly curious about this error. Can someone
help me?

Thanks a lot,

-Jose

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About