1Filter::m4(3)         User Contributed Perl Documentation        Filter::m4(3)
2
3
4

NAME

6       Filter::m4 - M4 source filter
7

SYNOPSIS

9           use Filter::m4;
10           use Filter::m4 'prefix';
11

DESCRIPTION

13       This source filter pipes the current source file through the M4 macro
14       processor ("m4") if it is available.
15
16       As with all source filters its scope is limited to the current source
17       file only.  Every file you want to be processed by the filter must have
18       the following line near the top.
19
20           use Filter::m4;
21

EXAMPLE

23       Here is a small example that shows how to define and use an M4 macro:
24
25           use Filter::m4;
26
27           define(`foo', `$1 =~ s/bar/baz/r')
28
29           $a = "foobar";
30           print "a = " . foo(`$a') . "\n";
31
32       The output of the above example:
33
34           a = foobaz
35

NOTES

37       By default, M4 uses ` and ' as quotes; however, this is configurable
38       using M4's "changequote" builtin.
39
40       M4 uses $1, $2, etc., to indicate arguments in macros.  To avoid
41       clashes with Perl regex syntax it is recommended to use Perl's
42       alternative forms "${1}", "${1}", etc.
43
44       The following keywords in M4 and Perl are identical:
45
46           eval
47           format
48           index
49           mkstemp
50           shift
51           substr
52
53       If you need such keywords in your Perl code you have to use one of the
54       following three solutions.
55
56       •   Protect the keyword with M4 quotes, for example `shift'.
57
58       •   Redefine the problematic M4 builtin using "defn", as outlined in
59           section Renaming macros of the M4 info manual.
60
61       •   Use the "prefix" option.  This adds the prefix "m4_" to all M4
62           builtins (but not to user-defined macros).  For example, you will
63           have to use "m4_shift" instead of "shift".
64

AUTHOR

66       Werner Lemberg
67

DATE

69       17th March 2018.
70
71
72
73perl v5.38.0                      2023-07-20                     Filter::m4(3)
Impressum