NAME

append_postamble - Inject custom Makefile targets into Dist::Zilla generated Makefile.PL

SYNOPSIS

perl dev/append_postamble Makefile.PL

DESCRIPTION

This script reads custom Makefile targets from dev/Makefile.targets and injects them into a Dist::Zilla generated Makefile.PL file via a postamble subroutine. It automatically filters out targets that conflict with ExtUtils::MakeMaker's built-in targets.

The script is designed to run as part of the Dist::Zilla build process via the Run::AfterBuild plugin.

FUNCTIONS

read_targets_file($targets_file)

Reads the contents of the targets file and returns it as a string.

filter_conflicting_targets($targets_content)

Removes targets that would conflict with ExtUtils::MakeMaker's built-in targets (test, clean, install) to avoid "target redefined" warnings.

create_postamble($targets_content)

Creates the Perl code for the MY::postamble subroutine that will be injected into the Makefile.PL.

read_makefile_pl($makefile_pl)

Reads the Makefile.PL file and returns its contents.

write_makefile_pl($makefile_pl, $content)

Writes the modified content back to the Makefile.PL file.

inject_postamble($content, $postamble)

Injects the postamble code before the WriteMakefile call in the Makefile.PL.

main

Main program logic that orchestrates the entire process.

AUTHOR

Paul Johnson <paul@pjcj.net>

COPYRIGHT

Copyright 2025 Paul Johnson.

LICENCE

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