mkchild.pl

来自「一个rst守护程序」· PL 代码 · 共 42 行

PL
42
字号
#!/usr/bin/perl## Just a simple library to start a forked# child process.## Written by Bastian Ballmann [ bytebeater@crazydj.de ]# http://www.crazydj.de ## Last Update: 29.07.2002## This code is licensed under the GPL# Create a child process and start a subroutinesub mkchild{    # Referenz auf die aufzurufende Subroutine    my $sub = shift;    # Reference auf einen Hash mit Parametern    my $args = @_;    # Fork child process    my $pid = fork();    die "Cannot fork a child process!\n$!\n" unless defined $pid;    if($pid == 0)    {	# Call the subroutine	if(ref($sub))	{	    &$sub(%$args);	}	# Execute via system() call	else	{	    system("$sub");	}    }}1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?