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" and add code to your "xs" / "c"
15 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 XS
26 #include "EVAPI.h"
27
28 BOOT:
29 I_EV_API ("YourModule");
30
32 See the EVAPI.h <http://cvs.schmorp.de/EV/EV/EVAPI.h> header, which you
33 should include instead of ev.h.
34
35 In short, all the functions and macros from ev.h should work, except
36 that the trailing underscore macros ("EV_A_", "EV_DEFAULT_") are not
37 available (except "EV_P_" :).
38
39 Multiplicity is enabled.
40
41 The "data" member in each watcher is of type "SV *" and not "void *"
42 (this might change at some point).
43
45 The EV::Glib, EV::ADNS and Glib::EV modules all give nice examples on
46 how to use this module.
47
48 Here are some .xs fragments taken from EV::ADNS that should get you
49 going:
50
51 #include "EVAPI.h"
52
53 static ev_prepare pw;
54 static ev_idle iw;
55
56 static void
57 idle_cb (EV_P_ ev_idle *w, int revents)
58 {
59 ev_idle_stop (EV_A, w);
60 }
61
62 MODULE = ...
63
64 BOOT:
65 {
66 I_EV_API ("EV::ADNS");
67 ev_prepare_init (&pw, prepare_cb);
68 ev_init (&iw, idle_cb); ev_set_priority (&iw, EV_MINPRI);
69 ev_idle_start (EV_DEFAULT, &iw);
70 }
71
72
73
74perl v5.28.0 2008-04-07 EV::MakeMaker(3)