.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Module::Install::Substitute 3pm" .TH Module::Install::Substitute 3pm "2020-12-06" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Module::Install::Substitute \- substitute values into files before install .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 8 \& ... Makefile.PL ... \& substitute( \& { \& LESS => \*(Aq/usr/bin/less\*(Aq, \& APXS => \*(Aq/usr/bin/apxs2\*(Aq, \& }, \& \*(Aqbin/my\-app\*(Aq \& ); \& \& ... bin/my\-app ... \& ### after: my $less_path = \*(Aq@LESS@\*(Aq; \& my $less_path = \*(Aq/usr/bin/less\*(Aq; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" 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. .SH "METHODS" .IX Header "METHODS" .ie n .SS "substitute {\s-1SUBSTITUTIONS\s0} [{\s-1OPTIONS\s0}] @FILES" .el .SS "substitute {\s-1SUBSTITUTIONS\s0} [{\s-1OPTIONS\s0}] \f(CW@FILES\fP" .IX Subsection "substitute {SUBSTITUTIONS} [{OPTIONS}] @FILES" Takes a hash reference with substitutions key value pairs, an optional hash reference with options and a list of files to deal with. .PP \fIOptions\fR .IX Subsection "Options" .PP Several options are available: .IP "sufix" 3 .IX Item "sufix" Sufix for source files, for example you can use sufix \f(CW\*(C`.in\*(C'\fR and results of processing of \fIMakefile.in\fR would be written into file \fIMakefile\fR. Note that you don't need to specify sufixes in the list of files. .IP "from" 3 .IX Item "from" Source base dir. By default it's the current working directory (Cwd). All files in the list are treated as relative to this directory. .IP "to" 3 .IX Item "to" Destination base dir. By default it's the current working directory (Cwd). .PP \fIFile format\fR .IX Subsection "File format" .PP In the files the following constructs are replaced: .PP .Vb 2 \& ###\es*after:\es?some string with @KEY@ \& some string with @KEY@ \& \& some string with value \& ###\es*before:\es?some string with @KEY@ \& \& ###\es*replace:\es?some string with @KEY@ .Ve .PP So string should start with three # characters followed by optional spaces, action keyword and some string where \f(CW@SOME_KEY\fR@ are substituted. .PP 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. .SH "AUTHOR" .IX Header "AUTHOR" Ruslan Zakirov .SH "" .IX Header ""