Using the || or using an or works either way on my machine. Running it as an unpriviledged user, the daemon dies saying that it doesn't have permission to create the file. However running it as root and the daemon runs without a hitch except for the fact that no pid file is created. When I look in /var/run for the keeperd.pid file its missing. What could be going wrong here? If keeperd couldn't make the file it should be complaining, but there's every indication that it is making the file.
BMaximus
Comment on Re: Re: Daemon sub refuses to daemonize. Why?
If this were my code, I would probably not write it this way to begin with. Instead, I would assign the reference returned by IO::File->new to a scalar then check to make sure it's defined.
Something like:
my $fh = IO::File->new($file, O_WRONLY|O_CREAT|O_EXCL,0644);
die "Can't create $file: $!\n" unless defined $fh;
return $fh;