#!perl -w

use strict;

eval "use CPAN::FindDependencies;";
if($@) {
    print STDERR "Couldn't load CPAN::FindDependencies.\n";
}

my @deps = CPAN::FindDependencies::finddeps(
    shift,
    nowarnings => 1,
    @ARGV
);

foreach my $dep (@deps) {
    print '  ' x $dep->depth();
    print '*' if($dep->warning());
    print $dep->name().' ('.$dep->distribution().")\n";
}

=head1 NAME

cpandeps - show a module on the CPAN's dependency tree.

=head1 DESCRIPTION

This program is a simple wrapper around CPAN::FindDependencies.

Given a module name, this program will show you the module's
dependency tree.  It takes exactly the same arguments as the
C<finddeps> function of CPAN::FindDependencies, with the exception
that C<nowarnings> is turned *on* by default.

It shows the module name, its distribution, and if any warnings were
raised (such as if a module's dependencies couldn't be fetched) this
is indicated with an asterisk before the module's name.

=head1 SYNOPSIS

    cpandeps CPAN::FindDependencies

    cpandeps CPAN::FindDependencies perl 5.8.8 cachedir ../foo/bar

=head1 WARNINGS, BUGS and FEEDBACK

This script has not been thoroughly tested.

I welcome feedback about my code, including constructive criticism.
Bug reports should be made using L<http://rt.cpan.org/> or by email.

=head1 SEE ALSO

L<CPAN::FindDependencies>

L<http://deps.cpantesters.org/>

=head1 AUTHOR, LICENCE and COPYRIGHT

Copyright 2007 - 2009 David Cantrell E<lt>F<david@cantrell.org.uk>E<gt>

This software is free-as-in-speech software, and may be used,
distributed, and modified under the terms of either the GNU
General Public Licence version 2 or the Artistic Licence. It's
up to you which one you use. The full text of the licences can
be found in the files GPL2.txt and ARTISTIC.txt, respectively.

=head1 CONSPIRACY

This software is also free-as-in-mason.

=cut
