First, you need a comma to complete the assignment on line 9:
$SIG{TERM} = sub { $continue = 0 ; };
Until I added that your program does not even start, so I assume that you have this in a script and skipped it here.
, , , . . top. script, Perl. , Perl. script , , .
- die warn . , (, top, ). , , .
: Yup, + STDERR = , . , , , STDERR:
Proc::Daemon::Init();
my $continue = 1;
$SIG{TERM} = sub { $continue = 0 ; };
while ( $continue ) {
sleep(5);
greeting();
}
sub greeting {
open STDERR, '>>', '/Users/telemachus/log'
or die "Can't reopen STDERR to log: $!";
open my $fh, '>>', '/usr/local/foo'
or warn "Can't open /usr/local/foo for writing: $!";
print $fh "hello word\n";
close $fh;
}
, :
foo : Permission denied at daemon line 21. print() $fh 22.