1EV::MakeMaker(3) User Contributed Perl Documentation EV::MakeMaker(3)
2
3
4
6 EV::MakeMaker - MakeMaker glue for the C-level EV API
7
9 This allows you to access some libevent functionality from other perl
10 modules.
11
13 For optimal performance, hook into EV at the C-level. You'll need to
14 make changes to your "Makefile.PL", load "EV" in your "pm" file and add
15 code to your "xs" / "c" file(s).
16
18 Makefile.PL
19 use EV::MakeMaker qw(ev_args);
20
21 # ... set up %args ...
22
23 WriteMakefile (ev_args (%args));
24
25 extension.pm
26 use EV (); # imports optional
27
28 extension.xs
29 #include "EVAPI.h"
30
31 [...]
32
33 BOOT:
34 I_EV_API (HvNAME (GvSTASH (CvGV (cv))));
35
37 See the EVAPI.h <http://cvs.schmorp.de/EV/EV/EVAPI.h> header, which you
38 should include instead of ev.h.
39
40 In short, all the functions and macros from ev.h should work, except
41 that the trailing underscore macros ("EV_A_", "EV_DEFAULT_") are not
42 available (except "EV_P_" :).
43
44 Multiplicity is enabled.
45
46 The "data" member in each watcher is of type "SV *" and not "void *"
47 (this might change at some point).
48
50 The EV::Glib, EV::ADNS and Glib::EV modules all give nice examples on
51 how to use this module.
52
53 Here are some .xs fragments taken from EV::ADNS that should get you
54 going:
55
56 #include "EVAPI.h"
57
58 static ev_prepare pw;
59 static ev_idle iw;
60
61 static void
62 idle_cb (EV_P_ ev_idle *w, int revents)
63 {
64 ev_idle_stop (EV_A, w);
65 }
66
67 MODULE = ...
68
69 BOOT:
70 {
71 I_EV_API ("EV::ADNS");
72 ev_prepare_init (&pw, prepare_cb);
73 ev_init (&iw, idle_cb); ev_set_priority (&iw, EV_MINPRI);
74 ev_idle_start (EV_DEFAULT, &iw);
75 }
76
77
78
79perl v5.30.1 2020-01-29 EV::MakeMaker(3)