1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/env perl
eval 'echo "Called with something not perl"' && exit 1 # Non-Perl protection.
if 0;
use 5.12.2;
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
use env::gentoo::perl_experimental;
use optparse;
use metacpan qw( mcpan );
my $optparse = optparse->new(
argv => \@ARGV,
help => sub {
return print <<'EOF';
module_log.pl
USAGE:
module_log.pl Class::MOP::Class
# See Class::MOP::Class started in Class-MOP and moved to Moose
#
# NOTE: Due to a caveat in PAUSE with how indexing works, Modules may look
# like they're comming from weird places.
#
# this is usually due to somebody lexically hacking a foreign package like so:
#
# { package Foo; blah blah blah }
#
# Unfortunately, PAUSE indexer sees that 'package Foo' and then deems this a place 'Foo' is defined.
#
# Usually that doesn't pose a problem, as the author who releases the containing package rarely has
# AUTHORITY permssion on the hacked package, so it doesn't get indexed. ( ie: HTTP::Request::Common )
#
# However, in the event the author has permissions to publish 'Foo', the indexer runs the risk
# of taking that tiny little package declaration as *the most recent version of that package*
# and is likely to try installing it. ( ie: HTTP::Message )
#
# For the most part, the "indexed but not authorised" case is eliminated by the query,
# but we have to weed out some false matches client side due to a current API limitation.
#
# but you can turn this weeding off for diagnostic reasons with
#
# module_log.pl --notrim HTTP::Message
#
# PROTIP: Usually when people do this foreign hacking, they don't define a VERSION in the same context
# which thankfully gives you the ability to assume its not sourceable.
#
# Try this:
#
# module_log.pl --notrim HTTP::Request::Common
#
# and see all the hacking in Apache-TestRequest turn up =)
#
EOF
},
);
# 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
use Data::Dump qw( pp );
my ($release) = shift( @{$optparse->extra_opts} );
my (@data) = metacpan->find_dist_simple( $release, $optparse->long_opts );
if ( not $optparse->long_opts->{dump} ) {
my $result = [ map { $_->{as_string} } @data ];
use JSON qw( to_json );
say to_json( $result, { pretty => 1 } );
}
else {
pp $_ for @data;
}
1;
|