I am getting the error
Undefined subroutine &main::1 called at /usr/local/lib/perl/5.10.0/HTML/Parser.pm line 102.
Here is my code
#open (IN, "<", "foo.html") or die "can't open source file: $!";
my $p = HTML::Parser->new( api_version => 3,
start_h => [&start, "tagname, attr, text"],
text_h => [&text, "text"],
default_h => [sub { print OUT shift }, "text"],
);
$p->utf8_mode;
$p->empty_element_tags;
$p->ignore_elements(qw(br));
$p->parse_file("foo.html") or die "parsing failed: $!";
#while (<IN>) {
# $p->parse($_) || die "parsing failed: $!";
#}
#$p->eof;
#close IN;
As you can see in the commented out parts I have also tried directly opening and calling parse (with equally little luck).
The file does open fine.
Parser.pm line 102 which is error mentions is the parse_file subroutine, specifically the line calling ->parse
I have no clue where parse is, it is not in HTML::Parser nor did I find it in HTML::Entities the only dependency HTML::Parser has. =/ I am afraid I am lost at this point, the deepest magics of PERL are still a mystery to me.
use strict; use warnings;?parseis apparently an XS routine (i.e. it's implemented in C)