#!/usr/bin/perl # Sample program for the ChronicCallback sample. # Copyright 2004 by Rocco Caputo. Free software. # Same terms as Perl itself. Have fun! use warnings; use strict; use ChronicCallback; # Start a new recurring callback. Save its # handle so we can stop it later. my $ticker_id = ChronicCallback->start( Callback => \&poit, Interval => 1, ); my $count = 0; # Perform some regular task. Stop when enough # work has been done. sub poit { print "Poit #", ++$count, "\n"; ChronicCallback->stop(Id => $ticker_id) if $count >= 5; } # Run the timers. Otherwise nothing will happen. ChronicCallback->run(); exit;