Created
November 7, 2012 08:24
-
-
Save dpetrov/4030168 to your computer and use it in GitHub Desktop.
Install all favorited distributions
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/env perl | |
use strict; | |
use warnings; | |
use 5.010; | |
use Mojo::UserAgent; | |
my $url = shift @ARGV or die "Usage: $0 metacpan_author_url"; | |
my $ua = Mojo::UserAgent->new; | |
my $dom = $ua->get($url)->res->dom; | |
my @modules = $dom->find('td.release a')->pluck('text')->each; | |
for my $module (@modules) { | |
$module =~ s/-/::/g; | |
qx/cpanm $module/; | |
} |
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
# and another solution proposed from Stephen Thirlwall (sdt) (see comment below) | |
cpan_favorites() { | |
perl -Mojo -E "g('https://metacpan.org/author/$1')->dom('td.release a')->pluck('text')->each(sub{s/-/::/g;say})" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @dolmen. Just saw the tweet and was checking it out ;)