Skip to content

Instantly share code, notes, and snippets.

@niczero
Last active August 22, 2016 15:05
Show Gist options
  • Save niczero/7424940acf1e9f3ddcd74e36c6e028ce to your computer and use it in GitHub Desktop.
Save niczero/7424940acf1e9f3ddcd74e36c6e028ce to your computer and use it in GitHub Desktop.
Dump all Mojolicious plugins from CPAN for analysis
#!/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
#!/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