On Thu, May 13, 2004 at 06:08:01PM +0200, Marc A. Lehmann wrote: > Hi, with the current release of Event my programs start to fail with > this error message: > > Event: attempt to invoke now() method with callback unset on watcher > '??' at Event/t/00_basic.t line 13
Wow, I must have been asleep when I made that change. Try the attached patch. -- A new cognitive theory of emotion, http://openheartlogic.org
# This is a patch for Event-0.88 to update it to Event # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -c 'Event-0.88/ChangeLog' 'Event/ChangeLog' Index: ./ChangeLog *** ./ChangeLog Wed Apr 21 19:26:34 2004 --- ./ChangeLog Fri May 14 18:47:49 2004 *************** *** 1,3 **** --- 1,20 ---- + 2004-05-14 <[EMAIL PROTECTED]> + + * c/watcher.c (pe_watcher_now): Check for a missing callback, not + only a missing perl callback. Marc A. Lehmann <[EMAIL PROTECTED]> + + 2004-04-26 <[EMAIL PROTECTED]> + + * lib/Event.pm (import): Make NO_TIME_HIRES actually work. Jerry + D. Hedden <[EMAIL PROTECTED]> + + 2004-04-22 <[EMAIL PROTECTED]> + + * c/signal.c (pe_signal_stop): When a signal watcher stops, the + signal counter is cleared. Otherwise the signal watcher can + generate one last event after being stopped, which is a + bug. (Pointed out by Zefram <[EMAIL PROTECTED]>) + 2004-04-21 <[EMAIL PROTECTED]> * Release 0.88. diff -c 'Event-0.88/c/signal.c' 'Event/c/signal.c' Index: ./c/signal.c *** ./c/signal.c Thu Oct 5 23:19:44 2000 --- ./c/signal.c Fri May 14 18:42:15 2004 *************** *** 63,70 **** pe_signal *ev = (pe_signal*) _ev; int sig = ev->signal; PE_RING_DETACH(&ev->sring); ! if (PE_RING_EMPTY(&Sigring[sig])) rsignal(sig, SIG_DFL); } WKEYMETH(_signal_signal) { --- 63,73 ---- pe_signal *ev = (pe_signal*) _ev; int sig = ev->signal; PE_RING_DETACH(&ev->sring); ! if (PE_RING_EMPTY(&Sigring[sig])) { rsignal(sig, SIG_DFL); + Sigstat[0].hits[sig] = 0; + Sigstat[1].hits[sig] = 0; + } } WKEYMETH(_signal_signal) { diff -c 'Event-0.88/c/watcher.c' 'Event/c/watcher.c' Index: ./c/watcher.c *** ./c/watcher.c Wed Apr 21 11:43:07 2004 --- ./c/watcher.c Fri May 14 18:39:10 2004 *************** *** 294,300 **** static void pe_watcher_now(pe_watcher *wa) { pe_event *ev; if (WaSUSPEND(wa)) return; ! if (!WaPERLCB(wa)) { STRLEN n_a; croak("Event: attempt to invoke now() method with callback unset on watcher '%s'", SvPV(wa->desc,n_a)); } --- 294,300 ---- static void pe_watcher_now(pe_watcher *wa) { pe_event *ev; if (WaSUSPEND(wa)) return; ! if (!wa->callback) { STRLEN n_a; croak("Event: attempt to invoke now() method with callback unset on watcher '%s'", SvPV(wa->desc,n_a)); } diff -c 'Event-0.88/lib/Event.pm' 'Event/lib/Event.pm' Index: ./lib/Event.pm *** ./lib/Event.pm Wed Apr 21 19:26:08 2004 --- ./lib/Event.pm Mon Apr 26 08:34:49 2004 *************** *** 13,19 **** eval { require Carp::Heavy; }; # work around perl_call_pv bug XXX use vars qw($VERSION @EXPORT_OK $API $DebugLevel $Eval $DIED $Now); ! $VERSION = '0.88'; # If we inherit DynaLoader then we inherit AutoLoader; Bletch! require DynaLoader; --- 13,19 ---- eval { require Carp::Heavy; }; # work around perl_call_pv bug XXX use vars qw($VERSION @EXPORT_OK $API $DebugLevel $Eval $DIED $Now); ! $VERSION = '0.89'; # If we inherit DynaLoader then we inherit AutoLoader; Bletch! require DynaLoader; *************** *** 26,32 **** $DebugLevel = 0; $Eval = 0; # avoid because c_callback is exempt $DIED = \&default_exception_handler; - my $NO_TIME_HIRES = 0; @EXPORT_OK = qw(time all_events all_watchers all_running all_queued all_idle one_event sweep loop unloop unloop_all sleep queue --- 26,31 ---- *************** *** 34,39 **** --- 33,39 ---- sub import { my $pkg = shift; + our $NO_TIME_HIRES; my @sym; for my $sym (@_) { if ($sym eq 'NO_TIME_HIRES') { *************** *** 42,59 **** push @sym, $sym; } } - $pkg->export_to_level(1, undef, @sym); - } ! if (!$NO_TIME_HIRES) { eval { require Time::HiRes; }; if ($@ =~ /^Can\'t locate Time/) { ! # OK, just continue } elsif ($@) { ! die if $@; } else { ! cache_time_api(); # hook in high precision time } } # broadcast_adjust for Time::Warp? XXX --- 42,60 ---- push @sym, $sym; } } ! if (!$NO_TIME_HIRES) { eval { require Time::HiRes; }; if ($@ =~ /^Can\'t locate Time/) { ! # OK, just continue } elsif ($@) { ! die if $@; } else { ! cache_time_api(); # hook in high precision time } + } + + $pkg->export_to_level(1, undef, @sym); } # broadcast_adjust for Time::Warp? XXX #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Fri May 14 18:47:54 2004 # Generated by : makepatch 2.00_07* # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'ChangeLog' 29428 1084540669 0100444 # p 'c/signal.c' 3868 1084540335 0100444 # p 'c/watcher.c' 9719 1084540150 0100444 # p 'lib/Event.pm' 4957 1082948689 0100444 #### End of ApplyPatch data #### #### End of Patch kit [created: Fri May 14 18:47:54 2004] #### #### Patch checksum: 192 5740 358 #### #### Checksum: 210 6415 56334 ####
signature.asc
Description: Digital signature