{
    "mode": "perldoc",
    "parameter": "Filter::m4",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Filter%3A%3Am4/json",
    "generated": "2026-10-09T03:23:32Z",
    "synopsis": "use Filter::m4;\nuse Filter::m4 'prefix';",
    "sections": {
        "NAME": {
            "content": "Filter::m4 - M4 source filter\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Filter::m4;\nuse Filter::m4 'prefix';\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This source filter pipes the current source file through the M4 macro processor (\"m4\") if it is\navailable.\n\nAs with all source filters its scope is limited to the current source file only. Every file you\nwant to be processed by the filter must have the following line near the top.\n\nuse Filter::m4;\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "Here is a small example that shows how to define and use an M4 macro:\n\nuse Filter::m4;\n\ndefine(`foo', `$1 =~ s/bar/baz/r')\n\n$a = \"foobar\";\nprint \"a = \" . foo(`$a') . \"\\n\";\n\nThe output of the above example:\n\na = foobaz\n",
            "subsections": []
        },
        "NOTES": {
            "content": "By default, M4 uses ` and ' as quotes; however, this is configurable using M4's \"changequote\"\nbuiltin.\n\nM4 uses $1, $2, etc., to indicate arguments in macros. To avoid clashes with Perl regex syntax\nit is recommended to use Perl's alternative forms \"${1}\", \"${1}\", etc.\n\nThe following keywords in M4 and Perl are identical:\n\neval\nformat\nindex\nmkstemp\nshift\nsubstr\n\nIf you need such keywords in your Perl code you have to use one of the following three\nsolutions.\n\n*   Protect the keyword with M4 quotes, for example `shift'.\n\n*   Redefine the problematic M4 builtin using \"defn\", as outlined in section *Renaming macros*\nof the M4 info manual.\n\n*   Use the \"prefix\" option. This adds the prefix \"m4\" to all M4 builtins (but not to\nuser-defined macros). For example, you will have to use \"m4shift\" instead of \"shift\".\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Werner Lemberg\n",
            "subsections": []
        },
        "DATE": {
            "content": "17th March 2018.\n",
            "subsections": []
        }
    },
    "summary": "Filter::m4 - M4 source filter",
    "flags": [],
    "examples": [
        "Here is a small example that shows how to define and use an M4 macro:",
        "use Filter::m4;",
        "define(`foo', `$1 =~ s/bar/baz/r')",
        "$a = \"foobar\";",
        "print \"a = \" . foo(`$a') . \"\\n\";",
        "The output of the above example:",
        "a = foobaz"
    ],
    "see_also": []
}