--- lib/PXElator/server.pm 2009/07/30 21:31:30 67 +++ lib/PXElator/server.pm 2009/08/03 08:52:32 118 @@ -2,7 +2,8 @@ use warnings; use strict; -use File::Slurp; + +use Module::Refresh; our $ip = '172.16.10.1'; our $netmask = '255.255.255.0'; @@ -11,16 +12,22 @@ our $base_dir = '/home/dpavlin/llin/pxelator'; -our $debug = 0; -sub debug { - my $new = shift; - my $path ="$base_dir/conf/debug"; - if ( defined $new ) { - write_file $path, $debug = $new; - } else { - $debug = read_file $path if -e $path; - } - return $debug; -} +use config; + +our $debug; +sub debug { $debug = config::shared('debug', @_) || 0 } + +my $timestamp_interval = 3; +my $stderr_tell = 0; + +$SIG{ALRM} = sub { + if ( tell(STDERR) != $stderr_tell ) { + warn "\nTIMESTAMP: " . localtime() . "\n\n"; + $stderr_tell = tell(STDERR); + Module::Refresh->refresh; + } + alarm $timestamp_interval; +}; +alarm $timestamp_interval; warn "loaded";