Skip Menu |

This queue is for tickets about the Event-Lib CPAN distribution.

Report information
The Basics
Id: 15742
Status: resolved
Priority: 0/
Queue: Event-Lib

People
Owner: Nobody in particular
Requestors: lloy0076 [...] adam.com.au
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.09
Fixed in: (no value)



Subject: Timer Event Not Firing
# dpkg -l | grep libevent ii libevent-dev 1.1a-1 Development libraries, header files and docs ii libevent1 1.1a-1 An asynchronous event notification libra This program does not do what I expect it to: -- #!/usr/bin/perl use Event::Lib qw/no_poll/; my $second; sub timer { my $event = shift; print "\r ", ++$seconds; $event->add(1); } print $Event::Lib::VERSION, "\n"; my $timer = timer_new(\&timer); $timer->add(1); event_dispatch(); -- # perl [that program] 0.09 -- The -- are not part of the output. I expect to see a series of: 1 2 3 etc etc Perl Version: Summary of my perl5 (revision 5 version 8 subversion 7) configuration: O/S: Linux gondor 2.6.11 #1 Sun Jun 5 11:04:21 CST 2005 i686 GNU/Linux [that is Debian Sid with a customer 2.6.11 kernel] PS: I've tried the same thing on Mac OS X with similar results (or lack of results). DSL
Date: Sun, 13 Nov 2005 09:18:37 +0100
From: Tassilo von Parseval <tassilo.von.parseval [...] rwth-aachen.de>
Subject: Re: [cpan #15742] Timer Event Not Firing
To: Guest via RT <bug-Event-Lib [...] rt.cpan.org>
RT-Send-Cc:
On Sat, Nov 12, 2005 at 10:49:57PM -0500 Guest via RT wrote: Show quoted text
> > This message about Event-Lib was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=15742 > > > # dpkg -l | grep libevent > ii libevent-dev 1.1a-1 Development libraries, header files and docs > ii libevent1 1.1a-1 An asynchronous event notification libra > > This program does not do what I expect it to: > > -- > #!/usr/bin/perl > > use Event::Lib qw/no_poll/; > > my $second; > sub timer { > my $event = shift; > print "\r ", ++$seconds; > $event->add(1); > } > > print $Event::Lib::VERSION, "\n"; > > my $timer = timer_new(\&timer); > > $timer->add(1); > > event_dispatch(); > -- > > # perl [that program] > 0.09 > > -- > > The -- are not part of the output. I expect to see a series of: > > 1 > 2 > 3 > etc etc
This is a problem with output buffering and not Event::Lib (luckily:-). The events are triggered but you just can't see it. Please add $| = 1; to the beginning of your program so that a flush is issued after each print. If you don't want to globally turn on autoflushing (as it decreases performance) you can also do use IO::Handle; ... print "\r", ++$seconds; STDOUT->flush; Cheers, Tassilo -- use bigint; $n=71423350343770280161397026330337371139054411854220053437565440; $m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
From: lloy0076 [...] adam.com.au
Tassilo et al, Show quoted text
> This is a problem with output buffering and not Event::Lib (luckily:- > ). > The events are triggered but you just can't see it. Please add > > $| = 1; > > to the beginning of your program so that a flush is issued after each > print. If you don't want to globally turn on autoflushing (as it > decreases performance) you can also do > > use IO::Handle; > ... > > print "\r", ++$seconds; > STDOUT->flush;
Indeed, this "fixed" the problem - maybe a comment about this in the POD might be in order because the solution isn't terribly obvious IMHO. DSL (ps) I don't seem to able to resolve bugs btw...
[guest - Sun Nov 13 17:41:42 2005]: Show quoted text
> > Tassilo et al, >
> > This is a problem with output buffering and not Event::Lib (luckily:- > > ). > > The events are triggered but you just can't see it. Please add > > > > $| = 1; > > > > to the beginning of your program so that a flush is issued after each > > print. If you don't want to globally turn on autoflushing (as it > > decreases performance) you can also do > > > > use IO::Handle; > > ... > > > > print "\r", ++$seconds; > > STDOUT->flush;
> > Indeed, this "fixed" the problem - maybe a comment about this in the POD > might be in order because the solution isn't terribly obvious IMHO.
Can do. I'm currently sorting out a few other issues with Event::Lib that will end up in a new release soon so I'll make the appropriate additions to the PODs. Thanks for mentioning this glitch! Show quoted text
> DSL > > (ps) I don't seem to able to resolve bugs btw...
I think only the Godfather of the respective project is allowed to do that. :-p