NAME

makefilepl2cpanfile - Convert a Makefile.PL to a cpanfile

VERSION

This document describes makefilepl2cpanfile as shipped with App::makefilepl2cpanfile version 0.06.

SYNOPSIS

bin/makefilepl2cpanfile [options]

Options:

--with-develop    Include author/development dependencies (default)
--no-develop      Exclude author/development dependencies
--dry-run         Print output to STDOUT instead of writing cpanfile
--diff            Show a unified diff against the existing cpanfile
--check           Verify all Makefile.PL dependencies appear in output
--help            Show this usage message

DESCRIPTION

Reads a Makefile.PL in the current directory and generates a corresponding cpanfile using "generate" in App::makefilepl2cpanfile. Existing develop blocks in a pre-existing cpanfile are preserved and merged.

By default the result is written to cpanfile in the current directory and cpanfile written successfully. is printed. The file is replaced in one step: if anything fails (reading, generating, a full disk, the final rename), the program exits with a non-zero status, the previous cpanfile is left exactly as it was, and no temporary files remain. A newly created cpanfile gets the permissions a new file normally would (0666 less the umask).

  • --dry-run prints the result to STDOUT and writes nothing.

  • --diff prints a unified diff from the existing cpanfile (or from an empty file when there is none) to the result, and writes nothing.

  • --check additionally verifies that every module found by "parse_prereqs" in App::makefilepl2cpanfile appears in the result, printing All Makefile.PL prerequisites are present in the output. or warning with the list of missing modules:

    WARNING: The following modules from Makefile.PL did not appear in the output:
      Some::Module

    (one module per line, indented by two spaces). It does not change what is written, but when modules are missing the program exits with status 1, so a CI job can fail on it.

  • --with-develop and --no-develop select the with_develop argument; giving both is an error (--with-develop and --no-develop are mutually exclusive) and the program exits with a non-zero status.

  • --help prints the usage message and exits with status 0.

  • If cpanfile exists but is not a regular file (a directory, a FIFO, a device) the program stops with Refusing to use 'cpanfile': it is not a regular file and a non-zero exit status.

  • If cpanfile is a symbolic link the program stops with Refusing to use 'cpanfile': it is a symbolic link and a non-zero exit status, without reading or writing it. Writing would otherwise replace whatever file the link points to, which in a cloned repository could be any file of yours.

SEE ALSO

App::makefilepl2cpanfile - the library this program uses; its documentation describes what is read from Makefile.PL, the output format, the configuration file and the encoding rules in full.

SUPPORT

This program is provided as-is without any warranty.

AUTHOR

Nigel Horne <njh@nigelhorne.com>

LICENSE AND COPYRIGHT

Copyright 2025-2026 Nigel Horne.

Usage is subject to the GPL2 licence terms. If you use it, please let me know.