in reply to perl daemon

I'm afraid you will have to test the value of $^O and load some OS specific modules or define some subroutines. I can't comment on the Unix side, but you might end up with something like:

BEGIN { if ($^O eq 'MSWin32') { eval <<'*END*'; use Win32::Daemon::Simple Service => 'SERVICENAME', Name => 'SERVICE NAME', Version => 'x.x', Info => { display => 'SERVICEDISPLAYNAME', description => 'SERVICEDESCRIPTION', }, Params => {}; *END* die $@ if $@; } else { eval <<'*END*'; # do whatever you need to make it a daemon under Unix sub DoEvents { # check the value of the variable you set in $SIG{...} handler +s # and stop if asked to } *END* die $@ if $@; } } while (1) { # do something sleep(60); DoEvents(); } __END__

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature