#!/usr/bin/perl use warnings; use Daemon::Generic; my $sleeptime = 1; newdaemon( progname => 'ticktockd', pidfile => '/var/run/ticktockd.pid', configfile => '/etc/ticktockd.conf', ); sub gd_preconfig { my ($self) = @_; open(CONFIG, ") { $sleeptime = $1 if /^sleeptime\s+(\d+)/; } close(CONFIG); return (); } sub gd_run { while(1) { sleep($sleeptime); print scalar(localtime(time))."\n"; } }