summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Fredric <kentfredric@gmail.com>2011-10-26 08:23:41 +1300
committerKent Fredric <kentfredric@gmail.com>2011-10-26 08:45:07 +1300
commitd384d09cd4451a333cd0278d1aefd5f1ffbfec25 (patch)
treef2188f69a58e2e101af45fcbfa1ffb3ab9cfc422 /scripts
parent[scripts/lib/metacpan.pm] add interesting reverse lookup code (diff)
downloadperl-overlay-d384d09cd4451a333cd0278d1aefd5f1ffbfec25.tar.gz
perl-overlay-d384d09cd4451a333cd0278d1aefd5f1ffbfec25.tar.bz2
perl-overlay-d384d09cd4451a333cd0278d1aefd5f1ffbfec25.zip
[scripts/module_log.pl] Pull out module history code into its own util
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/module_log.pl68
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/module_log.pl b/scripts/module_log.pl
new file mode 100755
index 000000000..cf0d4981b
--- /dev/null
+++ b/scripts/module_log.pl
@@ -0,0 +1,68 @@
+#!/usr/bin/env perl
+
+eval 'echo "Called with something not perl"' && exit 1 # Non-Perl protection.
+ if 0;
+
+use 5.14.2;
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use env::gentoo::perl_experimental;
+use metacpan qw( mcpan );
+
+my $flags;
+my $singleflags;
+
+@ARGV = grep { defined } map {
+ $_ =~ /^--(\w+)/
+ ? do { $flags->{$1}++; undef }
+ : do {
+ $_ =~ /^-(\w+)/
+ ? do { $singleflags->{$1}++; undef }
+ : do { $_ }
+ }
+} @ARGV;
+
+if ( $flags->{help} or $singleflags->{h} ) { print help(); exit 0; }
+
+# FILENAME: module_log.pl
+# CREATED: 25/10/11 12:15:51 by Kent Fredric (kentnl) <kentfredric@gmail.com>
+# ABSTRACT: Show the full history of a Module across distributions.
+
+# usage:
+#
+# module_log.pl Class::MOP
+# # emits both Class-MOP and Moose history
+my ($release) = shift(@ARGV);
+
+my $result = [ map { $_->{as_string} } metacpan->find_dist_simple( $release , {notrim=>1}) ];
+
+use Data::Dump qw( pp );
+use JSON qw( to_json );
+say to_json($result , { pretty => 1 } );
+1;
+
+sub pkg_for_module {
+ my ($module) = shift;
+
+}
+
+sub gen_dep {
+ state $template = qq{\t# %s%s\n\techo %s\n};
+ my ( $module, $version ) = @_;
+
+}
+
+sub help {
+ return <<'EOF';
+module_log.pl
+
+USAGE:
+
+ module_log.pl Class::MOP::Class
+
+ # See Class::MOP::Class started in Class-MOP and moved to Moose
+
+EOF
+}