[Kde-perl] Timers?

Germain Garand germain at ebooksfrance.org
Tue Jan 6 00:40:59 CET 2004


Le Lundi 05 Janvier 2004 14:08, Jaco Greeff a écrit :
> On Wednesday 24 December 2003 05:27, Germain Garand wrote:
> > Le Mercredi 17 Décembre 2003 10:15, Jaco Greeff a écrit :
> > > I'm trying to access two global variables from within a timer
> > > event. The code looks as follow:
> >
> > Hi Jaco,
> > I'm afraid I can't reproduce that... it just works here :-|
>
> Grrr, ok, let me try to generate a test case which I know fails...
>

Yes, please! I *love* standalone testcases! :-)
Seriously, it is a very tedious and error prone process to try rebuilding 
complete programs around the selected code snippets that are posted to the 
list.
Quite often, the bugs are not fully triggered by the snippets themselves so it 
ends up being frustrating.
Here, I more or less copy-pasted your code inside some random class, so that 
it looks like:

# globals
my $timeOStart = 0;
my $timeOEnd = -1;

sub someSlot: SLOT()
{
        print "foo\n";
        $timeOStart = time; # get current time
        $timeOEnd = 0;
        this->startTimer(1000);
}

sub timerEvent
{
        print "[$timeOEnd, $timeOStart]\n";
        print "." if ($timeOEnd > -1);
}

and upon  triggering someSlot, I get the output:

foo

[0, 1073343903]
.[0, 1073343903]
.[0, 1073343903]
.[0, 1073343903]
.[0, 1073343903]

which was even correct at the very instant where it was printed :)

> > P.S: your LiveCD installer shots are very nice! :-)
>
> Thanks, it looks nice but is currently a bit broken, but as they say, bs
> baffles ;)
>

Hey, getting the UI right first is very important, I think... that's much 
harder to change afterward than the inner guts, isn't it?


More information about the Kde-perl mailing list