#!perl -w
use HTML::TokeParser;
use LWP::Simple;
use strict;
## set marker definintions
my $content = get("http://www.cpan.org/modules/00modlist.long.html");
my $parse = HTML::TokeParser->new(\$content);
my @module;
my @links;
while (my $token = $parse->get_tag("a"))
{
my $url = $token->[1]{href} || "";
my $text = $parse->get_trimmed_text("/a");
if (($url =~ /module=/i) && $text)
{
push @links, quotemeta(qq($text));
my $header = quotemeta(qq(http://search.cpan.org/search?module=));
$url =~ s/^$header(.*?)/$1/i;
push @module, $url;
}
}
my @descs;
foreach my $link (@links)
{
my ($desc) = $content =~ /$link(.*?)\Q<\E/im;
push @descs, $desc;
}