in reply to Re: Having HTML::Parser problem
in thread Having HTML::Parser problem
Obligatory code (from one of my production projects):
sub extract_links { my $content = shift; my $extor = HTML::SimpleLinkExtor->new(); $extor->parse($content); my %seen; my @hrefs = grep { !$seen{$_}++} $extor->a; my @imgs = grep { !$seen{$_}++} $extor->img; my @fragments = grep {/#/} @hrefs; my @frag = map make_canon($_), @fragments; # Other magical stuff under here to turn relative # links from @imgs and @hrefs into absolute, using # the URI module, and some other hocus pocus. }
|
|---|