cpanemu - Pretend that CPAN has downloaded the package in the current directory


  cpanemu -m|-t|-i [Missing::Module [Missing::Module ...]]

    -m - Make package in current directory
    -t - Test package in current directory
    -i - Install package in current directory
    -d - Debug mode


  # Test how the current module behaves on CPAN without Module::Build installed
  cpanemu -t Module::Build


cpanemu runs the "distdir" action on a perl package, loads up CPAN, and tells it it has just downloaded a distribution.

Using the "-m", "-t", and "-i" switches, you can tell CPAN to attempt to "make", "test", and/or "install" your package. What you see when this happens should closely approximate what an end-user will see when they use the CPAN shell to download your package from CPAN.


Run "Makefile.PL" or "Build.PL" in your distribution. Then, run cpanemu in your distribution's directory, specifying the flags for the actions you want (-m for make, -t for test, -i for install).

Any other arguments specified are considered the names of modules that should be marked as missing. This will be done by generating fake packages that fail to load, making CPAN believe that they are not available. Note that only the current module will be tested; if some of these modules are prerequisites, they won't actually be downloaded, but you should expect CPAN's "Shall I follow them and prepend them to the queue" prompt if your module is set up correctly.


Test::CPANpm, CPAN


Tyler "Crackerjack" MacDonald <>


Copyright 2005 Tyler MacDonald.

This is free software; you may redistribute it under the same terms as perl itself.