Created
March 11, 2010 21:36
-
-
Save yusukebe/329689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use URI::Escape qw( uri_escape ); | |
use HTTP::Lite; | |
my $query = $ARGV[0] or die "query required\n"; | |
my $url = 'http://search.cpan.org/search?m=all&q=' . uri_escape( $query ); | |
my $http = HTTP::Lite->new; | |
$http->request( $url ); | |
my @paths = $http->body =~ m!<h2\s+class=sr><a\shref=\"/~[^/]+/([a-zA-Z\-]+)-!mg; | |
for my $path ( @paths ){ | |
$path =~ s/-/::/g; | |
print "$path\n"; | |
} | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment