#!/usr/local/bin/perl

use 5.010;

use strict;
use warnings;

use CPAN::Access::AdHoc;
use Getopt::Long 2.33;
use Pod::Usage;

our $VERSION = '0.000_04';

my %opt;

GetOptions( \%opt,
    help => sub { pod2usage( { -verbose => 2 } ) },
) and @ARGV or pod2usage( { -verbose => 0 } );

my $cad = CPAN::Access::AdHoc->new();

my $inx = $cad->fetch_author_index();

foreach my $cpan_id ( @ARGV ) {
    say sprintf '%-14s %s', $cpan_id, $inx->{$cpan_id}{address};
    foreach my $pkg ( $cad->corpus( $cpan_id ) ) {
	say "    $pkg";
    }
}

__END__

=head1 TITLE

corpus - List the indexed distributions of one or more CPAN authors.

=head1 SYNOPSIS

 corpus some_cpan_id
 corpus -help
 corpus -version

=head1 OPTIONS

=head2 -help

This option displays the documentation for this script. The script then
exits.

=head2 -version

This option displays the version of this script. The script then exits.

=head1 DETAILS

This Perl script retrieves and displays the names of all distributions
written by the authors whose CPAN IDs are given on the command line. The
CPAN IDs are not case-sensitive, since in use they are all upper case.

=head1 AUTHOR

Thomas R. Wyant, III F<wyant at cpan dot org>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2012 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl 5.10.0. For more details, see the full text
of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

=cut

# ex: set textwidth=72 :
