#!perl use strict; use warnings; use autodie; use Git; use Pod::Usage; use Getopt::Long; sub say (@) { print @_, "\n" } my %opt; GetOptions( \%opt, 'help' => sub { pod2usage(1) }, 'man' => sub { pod2usage( verbose => 2 ) }, ) or pod2usage( "for a list of all valid options, do 'git cpan-last-version --help'" ); my $repo = Git->repository; my $last_commit = $repo->command_oneline('rev-parse', '--verify', 'cpan/master'); my $last = join "\n", $repo->command( log => '--pretty=format:%b', '-n', 1, $last_commit ); $last =~ /git-cpan-module:\ (.*?) \s+ git-cpan-version:\ (.*?) \s*$/sx or die "Couldn't parse message:\n$last\n"; say $2; __END__ =pod =head1 NAME git-cpan-last-version - Report the last imported version =head1 VERSION version 0.4.2 =head1 SYNOPSIS % git cpan-last-version =head1 DESCRIPTION This command searches through the history of the C reference for the last imported version. =head1 BUGS AND LIMITATIONS Please report any bugs or feature requests to C, or through the web interface at L. =head1 AUTHORS Yuval Kogman C<< >> Yanick Champoux C<< >> =head1 LICENCE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L. =head1 SEE ALSO L =cut