怎么用perl写个守护程序呢?

怎么用perl写个守护程序呢?

怎么用perl写个守护程序呢?
参考一下perl 网络编程里的一段代码:

sub become_daemon {
  die "Can't fork" unless defined (my $child = fork);
  exit 0 if $child;    # parent dies;
  setsid();     # become session leader
  open(STDIN, "</dev/null");
  open(STDOUT,">/dev/null");
  open(STDERR,">&STDOUT");
  chdir '/';           # change working directory
  umask(0);            # forget file mode creation mask
  $ENV{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin';
  return $$;
}
能不能稍微解释一下呢