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
- alpine 3.24: perl-ev-doc 4.37-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms