Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

(ichimunki) Re: Querying a Server Periodically

by ichimunki (Priest)
on Dec 28, 2001 at 01:45 UTC ( #134734=note: print w/ replies, xml ) Need Help??

in reply to Querying a Server Periodically

This code could be adapted to a stateless protocol like HTTP for periodic server queries, I think.

#!/usr/bin/perl -w use strict; use Tk; #set up our window and some interactive feature my $mw = Tk::MainWindow->new(); my $button = $mw->Button( -text => 'Pop', -command => sub {print "pop! +\n";} )->pack(); #set up our periodic task. #this executes faithfully every x milliseconds $mw->repeat(5000, \&waiting ); MainLoop; sub waiting { print "waiting...\n"; }
5000 is the milliseconds amount (so it's a very big number for only 5 seconds, but you can also give number as 5 * 1000 to remind yourself and ease figuring out longer intervals. Give this small script a try, as long as you don't mind locking up the client while the updates are happening you don't have to resort to process forking like the Tk chatterbox does.

Comment on (ichimunki) Re: Querying a Server Periodically
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://134734]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-11-24 09:38 GMT
Find Nodes?
    Voting Booth?

    My preferred Perl binaries come from:

    Results (137 votes), past polls