--- EV/EV.xs 2013/01/15 21:49:38 1.162 +++ EV/EV.xs 2013/04/03 23:46:45 1.163 @@ -15,6 +15,10 @@ return s_fileno (fh, 0); } +#ifndef GvCV_set +# define GvCV_set(gv,cv) GvCV (gv) = cv +#endif + #define EV_STANDALONE 1 #define EV_PROTOTYPES 1 #define EV_USE_NANOSLEEP EV_USE_MONOTONIC @@ -383,7 +387,7 @@ const_iv (EV_, STAT) const_iv (EV_, IDLE) const_iv (EV_, PREPARE) - const_iv (EV_, CHECK) + /*const_iv (EV_, CHECK) needs special tretament */ const_iv (EV_, EMBED) const_iv (EV_, FORK) const_iv (EV_, CLEANUP) @@ -428,6 +432,16 @@ for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); + /* since this clashes with perl CHECK blocks, */ + /* but we are interested in constants, */ + /* and not blocks, we treat CHECK specially. */ + { + /* the local $^W = 0 takes care of the warning */ + CV *cv = newCONSTSUB (stash, "CHECK", newSViv (EV_CHECK)); + /* now we need to re-set the gv, in case it was hijacked */ + GvCV_set (gv_fetchpv ("EV::CHECK", GV_ADD, SVt_PVCV), cv); + } + stash_loop = gv_stashpv ("EV::Loop" , 1); stash_watcher = gv_stashpv ("EV::Watcher" , 1); stash_io = gv_stashpv ("EV::IO" , 1);