Not that these subs are repeatedly created, but this makes
the code easier-to-review and these callbacks are idempotent
anyways.
# The upgrade will create the ".oldbin" pid file in the
# same directory as the given pid file.
$uid and $set_user = sub {
+ $set_user = undef;
Net::Server::Daemonize::set_user($uid, $gid);
};
write_pid($pid_file);
my $unlink_pid = $$;
$cleanup = sub {
+ $cleanup = undef; # avoid cyclic reference
unlink_pid_file_safe_ish($unlink_pid, $pid_file);
};
}