EV::MakeMaker(3)

🌸 NAME 🌸

Bestie, this is the manual page for EV::MakeMaker(3) β€” aka EV::MakeMaker, from the User Contributed Perl Documentation β€” and it is literally the MakeMaker glue for the C-level EV API. That's the whole gig. πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

Okay so this lets you access some libevent functionality from other perl modules. Not all of it, bestie β€” some. ✨

πŸ’… DESCRIPTION πŸ’…

If you want optimal performance, you hook into EV at the C-level. Periodt. To make that happen, you're gonna make changes to your Makefile.PL, load EV in your pm file, and add code to your xs / c file(s). That's the whole recipe, no cap. 🫢

πŸŽ€ HOW TO πŸŽ€

🧚 Makefile.PL 🧚

In your Makefile.PL, you do this exact thing:

use EV::MakeMaker qw(ev_args);

# ... set up %args ...

WriteMakefile (ev_args (%args));

πŸ“ extension.pm πŸ“

Then in your pm file:

use EV (); # imports optional

The imports are optional β€” the comment says so, so don't come for me. 😌

🌸 extension.xs 🌸

And in your xs file, you need the C-level hookup:

#include "EVAPI.h"

[...]

BOOT:
  I_EV_API (HvNAME (GvSTASH (CvGV (cv))));

That BOOT: bit is doing the main character work. πŸ‘‘

πŸ”₯ API πŸ”₯

Peep the EVAPI.h <http://cvs.schmorp.de/EV/EV/EVAPI.h> header β€” and yes, you should include that instead of ev.h. Slay. πŸ¦‹

In short: all the functions and macros from ev.h should work, with one exception β€” the trailing underscore macros (EV_A_, EV_DEFAULT_) are not available (EV_P_ is the one exception :). Cute, right? πŸ’€

Multiplicity is enabled. πŸ”₯

The data member in each watcher is of type SV * and not void * β€” and this might change at some point. So don't get too attached, okay? πŸ™ˆ

πŸ’œ EXAMPLE πŸ’œ

The EV::Glib, EV::ADNS, and Glib::EV modules all give nice examples on how to use this module. They're iconic, honestly. 🌈

Here are some .xs fragments taken from EV::ADNS that should get you going:

#include "EVAPI.h"

static ev_prepare pw;
static ev_idle iw;

static void
idle_cb (EV_P_ ev_idle *w, int revents)
{
  ev_idle_stop (EV_A, w);
}

MODULE = ...

BOOT:
{
  I_EV_API ("EV::ADNS");
  ev_prepare_init (&pw, prepare_cb);
  ev_init (&iw, idle_cb); ev_set_priority (&iw, EV_MINPRI);
  ev_idle_start (EV_DEFAULT, &iw);
}

Okay bestie, that's the whole page β€” sourced from perl v5.42.2, dated 2026-02-15, and it's EV::MakeMaker(3). Go forth and hook into the C-level EV API, you absolute icon. πŸ’–βœ¨

πŸ“¦ where this page comes from