rel タグを持っていないリンクはとれないので、「nofollow のない A タグを抜き出す」という用途には使えません。HTML::LinkExtor を拡張してつくってみようかな。
モジュールにはしていませんが、HTML::TokeParser をつかったサンプル。需要がありそうなので公開。
sub followed_links {
my $html = shift;
my $p = HTML::TokeParser->new(\$html);
my @links;
while (my $token = $p->get_tag('a')) {
my $attr = $token->[1];
unless ($attr->{rel} && $attr->{rel} =~ /\bnofollow\b/) {
push @links, $attr->{href};
}
}
return @links;
}