Command-line tool to copy a perl module to a development directory


  pmhack Module::Name


Sometimes you want to debug an installed perl module, e.g. by sprinkling some print statements. Instead of being tempted to mess with the module code directly, it is a good practice to copy that module to a development directory, edit it there, and then add that directory to @INC so that perl uses the modified code instead of the original. pmhack is a tool to aid that - it grabs a module from <@INC>, puts it in a directory specified in the PERL5HACKLIB environment variable, creating all additional directories as needed, removes any read-only attributes from the file, and prints the new filename to STDOUT.


  • Create an environment variable PERL5HACKLIB and set it to a directory where modules will be copied for hacking

  • You may also want to add the above directory to PERL5LIB so that perl uses your hacked version rather than the installed version by default.

  • Install App::Pmhack from CPAN. It provides the pmhack command-line tool that you will use to copy modules.


Peter Shangov <pshangov at yahoo dot com>


This software is copyright (c) 2010 by Peter Shangov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.