Test::CPANpm is a Perl module to test a distribution's interaction with CPAN before uploading.
use Test::More qw(no_plan);
['CGI', 'Module::Build', 'Acme::Wabbit'],
'got the right dependancies'
['Some::Module::Build::Subclass', 'CGI', 'Module::Build', 'Acme::Wabbit'],
'got dependancies even though our Module::Build subclass is missing'
Test::CPANpm fools CPAN.pm into thinking it has downloaded and unpacked your package, then has it attempt to generate a Makefile or Build script. After this process completes, it asks your CPAN module what dependancies it thinks exist.
If you just want to make sure your distribution is packaged in a way that is good for CPAN, consider using Test::Distribution instead. The main time that Test::CPANpm is useful is when you depend on modules inside your Makefile.PL or Build.PL script and you want to make sure that you degrade gracefully if those modules are not available.