Last active
August 22, 2016 15:05
-
-
Save niczero/7424940acf1e9f3ddcd74e36c6e028ce to your computer and use it in GitHub Desktop.
Dump all Mojolicious plugins from CPAN for analysis
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.10.1; | |
# http://www.cpan.org/modules/02packages.details.txt.gz | |
my $module_list_filename = '02packages.details.txt'; | |
my @modules; | |
open my $fh, '<', $module_list_filename or die "Failed to open module list: $!"; | |
while (my $line = <$fh>) { | |
my ($module, $ver, $distro, $rest) = $line =~ /^(\S+)\s+(\S+)\s+(\S+)(.*)$/; | |
die "Failed to parse line ($line)\n" if $rest =~ /\S/; | |
push @modules, $module if $module =~ /^Mojolicious::Plugin::/; | |
} | |
close $fh; | |
printf "requires '%s';\n", $_ for @modules; | |
# time cpanm -l . -n --installdeps . >cpanm.log 2>cpanm.err |
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.10.1; | |
# perldoc -t perllocal | |
{ | |
local $/ = ': "Module" '; | |
<>; | |
while (defined(my $stanza = <>)) { | |
my ($module, $version) = $stanza =~ /\A(.*?)\n.+VERSION: ([^\"]+)/ms; | |
say $module, "\t", $version; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment