Skip to content

Instantly share code, notes, and snippets.

@bayashi
Created July 14, 2014 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayashi/275ad705d92c2dc79c5e to your computer and use it in GitHub Desktop.
Save bayashi/275ad705d92c2dc79c5e to your computer and use it in GitHub Desktop.
awesome-perl
use strict;
use warnings;
use Time::HiRes qw/sleep/;
use Furl;
my %awesome;
{
my $page = 1;
while ( my @index = get_index($page) ) {
last unless @index;
for my $path (@index) {
my @modules = get_belikes($path);
$awesome{$_}++ for @modules;
sleep 0.1;
}
$page++;
sleep 0.1;
}
for my $module (sort { $awesome{$b} <=> $awesome{$a} } keys %awesome) {
print "$module\t$awesome{$module}\n";
}
}
sub get_index {
my $page = shift || 1;
my $index = Furl->new->get("https://metacpan.org/search?q=Task%3A%3ABeLike&p=$page");
my @belike_list = ($index->content =~ m!<a href="(/pod/Task::BeLike::[^"]+)">!g);
return @belike_list;
}
sub get_belikes {
my $path = shift;
my $belike = Furl->new->get("https://metacpan.org$path");
my @modules = ($belike->content =~ m!<a href="/pod/[^"]+" title="([^"]+)" class="ellipsis">[^<]+</a>!g);
return @modules;
}
@bayashi
Copy link
Author

bayashi commented Jul 14, 2014

result

App::Ack 19
Perl::Tidy 18
JSON 18
Devel::NYTProf 17
JavaScript::Minifier::XS 1
YAML 17
Test::Pod 16
App::cpanminus 16
Dist::Zilla 16
Moose 15
DateTime 14
Test::Pod::Coverage 14
Devel::Cover 13
DBD::SQLite 13
DBI 12
App::cpanoutdated 11
Try::Tiny 11
LWP::Protocol::https 11
File::Slurp 11
CPAN::Mini 11
App::Nopaste 10
JSON::XS 10
URI 10
Plack 10
warnings 10
Moo 10
Module::Install 9
Term::ReadLine::Gnu 9
Pod::Coverage::TrustPod 9
WWW::Mechanize 9
strict 9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment