{
    "mode": "perldoc",
    "parameter": "Filter::m4",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Filter%3A%3Am4/json",
    "generated": "2026-06-16T10:43:39Z",
    "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\nprocessor (\"m4\") if it is available.\n\nAs with all source filters its scope is limited to the current source\nfile only. Every file you want to be processed by the filter must have\nthe 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\nusing M4's \"changequote\" builtin.\n\nM4 uses $1, $2, etc., to indicate arguments in macros. To avoid clashes\nwith Perl regex syntax it is recommended to use Perl's alternative forms\n\"${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\nfollowing three solutions.\n\n*   Protect the keyword with M4 quotes, for example `shift'.\n\n*   Redefine the problematic M4 builtin using \"defn\", as outlined in\nsection *Renaming macros* of the M4 info manual.\n\n*   Use the \"prefix\" option. This adds the prefix \"m4\" to all M4\nbuiltins (but not to user-defined macros). For example, you will\nhave 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": []
}