Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

jdavidb
  (email not shown publicly)
http://voiceofjohn.blogspot.com/

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Friday November 22, 2002
10:47 AM

all recent modules

[ #9090 ]

This prints out a list of recent modules, with no duplicates.

#!/usr/local/bin/perl5.8.0 -- # -*- perl -*-

use warnings;
use strict;

use LWP::Simple;
use HTML::TreeBuilder;

my $date = shift;  # yyyymmdd
my $url = "http://search.cpan.org/recent/";
$url .= "?d=$date" if $date;

my $recent_html = get($url);

my $recent = HTML::TreeBuilder->new_from_content($recent_html);

my $links = $recent->extract_links;

my %modules;
foreach my $link (@$links)
{
    my $linkval = $link->[0];
    next unless $linkval =~ m{^/author/.};
    $linkval =~ m|/([^/]*)/$|;
    my $dist = $1;
    my @dist = split "-", $dist;
    pop @dist while @dist and $dist[-1] =~ m/^[.\d_]*$/;
    warn unless @dist;
    my $module = join "::", @dist;
    next if $modules{$module};
    print "$module\n";
    $modules{$module} = 1;
}

Update 10:20 A.M., CST: Underscores are allowed in version numbers.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.