1
2
3
my $parser_cc = HTML::Parser->new();
$parser_cc->handler(start => \&start_handler,"tagname,self");
$parser_cc->parse($cc_string);
1
2
3
4
5
6
7
8
9
10
11
12
13
my $self = shift;
my $text;
if (shift eq "cc-name") {
$self->handler(text => sub{$text = shift;},"dtext");
$self->handler(end => sub{print $text,"\n\n" if(shift eq 'cc-name')},"tagname");
}
elsif (shift eq "cc_info") {
$self->handler(text => sub{$text = shift;},"dtext");
$self->handler(end => sub{print $text,"\n\n" if(shift eq 'cc_info')},"tagname");
}
else {
print "Fehler".$self;
}
1 2 3 4 5 6 7 8
my ($tagname, $self) = @_; if ($tagname eq "cc-name") { ... } elsif ($tagname eq "cc_info") { ... } ...
2013-05-22T13:03:17 TiefkuehlpizzaIm Endeffekt möchte ich den Inhalt verschiedener Tags in ein Array schreiben. Wenn ein besserer Ansatz existiert, immer her damit.