{
    "content": [
        {
            "type": "text",
            "text": "# Event::MakeMaker (perldoc)\n\n## NAME\n\nEvent::MakeMaker - MakeMaker glue for the C-level Event API\n\n## SYNOPSIS\n\nThis is an advanced feature of Event.\n\n## DESCRIPTION\n\nFor optimal performance, hook into Event at the C-level. You'll need to make changes to your\n\"Makefile.PL\" and add code to your \"xs\" / \"c\" file(s).\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **WARNING**\n- **HOW TO** (1 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Event::MakeMaker",
        "section": "",
        "mode": "perldoc",
        "summary": "Event::MakeMaker - MakeMaker glue for the C-level Event API",
        "synopsis": "This is an advanced feature of Event.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "WARNING",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "HOW TO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Makefile.PL",
                        "lines": 76
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "Event::MakeMaker - MakeMaker glue for the C-level Event API\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "This is an advanced feature of Event.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "For optimal performance, hook into Event at the C-level. You'll need to make changes to your\n\"Makefile.PL\" and add code to your \"xs\" / \"c\" file(s).\n",
                "subsections": []
            },
            "WARNING": {
                "content": "When you hook in at the C-level you get a *huge* performance gain, but you also reduce the\nchances that your code will work unmodified with newer versions of \"perl\" or \"Event\". This may\nor may not be a problem. Just be aware, and set your expectations accordingly.\n",
                "subsections": []
            },
            "HOW TO": {
                "content": "",
                "subsections": [
                    {
                        "name": "Makefile.PL",
                        "content": "use Event::MakeMaker qw(eventargs);\n\n# ... set up %args ...\n\nWriteMakefile(eventargs(%args));\n\nXS\n#include \"EventAPI.h\"\n\nBOOT:\nIEVENTAPI(\"YourModule\");\n\nAPI (v21)\nstruct EventAPI {\nI32 Ver;\n\n/* EVENTS */\nvoid (*queue   )(peevent *ev);\nvoid (*start   )(pewatcher *ev, int repeat);\nvoid (*now     )(pewatcher *ev);\nvoid (*stop    )(pewatcher *ev, int cancelevents);\nvoid (*cancel  )(pewatcher *ev);\nvoid (*suspend )(pewatcher *ev);\nvoid (*resume  )(pewatcher *ev);\n\n/* All constructors optionally take a stash and template.  Either\nor both can be NULL.  The template should not be a reference. */\npeidle     *(*newidle  )(HV*, SV*);\npetimer    *(*newtimer )(HV*, SV*);\npeio       *(*newio    )(HV*, SV*);\npevar      *(*newvar   )(HV*, SV*);\npesignal   *(*newsignal)(HV*, SV*);\n\n/* TIMEABLE */\nvoid (*tstart)(petimeable *);\nvoid (*tstop)(petimeable *);\n\n/* HOOKS */\npeqcallback *(*addhook)(char *which, void *cb, void *extdata);\nvoid (*cancelhook)(peqcallback *qcb);\n\n/* STATS */\nvoid (*installstats)(peeventstatsvtbl *esvtbl);\nvoid (*collectstats)(int yes);\npering *AllWatchers;\n\n/* TYPEMAP */\nSV   *(*watcher2sv)(pewatcher *wa);\nvoid *(*sv2watcher)(SV *sv);\nSV   *(*event2sv)(peevent *ev);\nvoid *(*sv2event)(SV *sv);\n};\n\nEXAMPLE\nstatic peio *X11ev=0;\n\nstatic void xserverdispatch(void *extdata)\n{ ... }\n\nif (!X11ev) {\nX11ev = GEventAPI->newio(0,0);\nX11ev->poll = PER;\nsvsetpv(X11ev->base.desc, \"X::Server\");\nX11ev->base.callback = (void*) xserverdispatch;\nX11ev->base.extdata = <whatever>;\nX11ev->base.prio = PEPRIONORMAL;\n}\nX11ev->fd = xfd;\nGEventAPI->resume((peevent*) X11ev);\nGEventAPI->start((peevent*) X11ev, 0);\n\nBUT I NEED A NEW TYPE OF WATCHER FOR MY INTERGALACTIC INFEROMETER\nI'd prefer not to export the entire Event.h apparatus in favor of minimizing interdependencies.\nIf you really, really need to create a new type of watcher send your problem analysis to the\nmailing list!\n"
                    }
                ]
            }
        }
    }
}