Module::Install::Substitute(3pm) | User Contributed Perl Documentation | Module::Install::Substitute(3pm) |
Module::Install::Substitute - substitute values into files before install
... Makefile.PL ... substitute( { LESS => '/usr/bin/less', APXS => '/usr/bin/apxs2', }, 'bin/my-app' ); ... bin/my-app ... ### after: my $less_path = '@LESS@'; my $less_path = '/usr/bin/less';
Module::Install::Substitute is an extension for Module::Install system that allows you to substitute values into files before install, for example paths to libs or binary executables.
Takes a hash reference with substitutions key value pairs, an optional hash reference with options and a list of files to deal with.
Options
Several options are available:
File format
In the files the following constructs are replaced:
###\s*after:\s?some string with @KEY@ some string with @KEY@ some string with value ###\s*before:\s?some string with @KEY@ ###\s*replace:\s?some string with @KEY@
So string should start with three # characters followed by optional spaces, action keyword and some string where @SOME_KEY@ are substituted.
This module can replace lines after or before above constructs based on action keyword to allow you to change files in place without moving them around and to make it possible to run substitution multiple times.
Ruslan Zakirov <ruz@cpan.org>
2020-12-06 | perl v5.32.0 |