当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: perl函数的参考手册,留着查阅方便。
 

 

 ·iptables howto(中文版)    »显示摘要«
    摘要:iptables -adc 指定链的规则 [-a 添加 -d 删除 -c 修改] ; -d chain rule num[option] ; -lfz 链名 [选项] ; -[nx] 指定链 ;-p chain target[options];-e old-chain-name new-chain-name iptables - ip包过滤器管理name iptables - ip包过滤器管理 总......
 ·linux filesystem hierarchy    »显示摘要«
    摘要:一直想深入的了解一些/proc目录下面的文件信息,google到了这里,暂时记录,等周二回来再看吧:)http://www.linuxforum.com/linux-filesystem/index.html好东西,老外写的东西真不错http://www.linuxforum.com/linux_tutorials/89/1.php......


perl附录(1)
perl函数的参考手册,留着查阅方便.

一.进程处理函数

【程序编程相关:关于Linux可执行文件的格式问题

【推荐阅读:Linux 170个常见问题的详细解答

1.进程启动函数 【扩展信息:安装CVS

函数名 eval 调用语法 eval(string) 解说 将string看作perl语句执行.

正确执行后,系统变量$@为空串,如果有错误,$@中为错误信息. 例子 $print = "print (\"hello,world\n\");";

eval ($print); 结果输出 hello, world

函数名 system 调用语法 system(list) 解说 list中第一个元素为程序名,其余为参数.

system启动一个进程运行程序并等待其结束,程序结束后错误代码左移八位成为返回值. 例子 @proglist = ("echo", "hello,world!");

system(@proglist); 结果输出 hello, world!

函数名 fork 调用语法 procid = fork(); 解说 创建程序的两个拷贝--父进程与子进程--同时运行.子进程返回零,父进程返回非零值,此值为子程序的进程id号. 例子 $retval = fork();

if ($retval == 0) {

# this is the child process

exit; # this terminates the child process

} else {

# this is the parent process

} 结果输出 无

函数名 pipe 调用语法 pipe (infile, outfile); 解说 与fork合用,给父进程与子进程提供通信的方式.送到outfile文件变量的信息可以通过infile文件变量读取.步骤:

1.调用pipe

2.用fork将程序分成父进程与子进程

3.一个进程关掉infile,另一个关掉outfile 例子 pipe (input, output);

$retval = fork();

if ($retval != 0) {

# this is the parent process

close (input);

print ("enter a line of input:\n");

$line = ;

print output ($line);

} else {

# this is the child process

close (output);

$line = ;

print ($line);

exit (0);

}

结果输出 $

program

enter a line of input:

here is a test line

here is a test line

$

函数名 exec 调用语法 exec (list); 解说 与system类似,区别是启动新进程前结束当前程序.常与fork合用,当fork分成两个进程后,子进程用exec启动另一个程序. 例子

结果输出


...   下一页
 ·redirect http to https    »显示摘要«
    摘要:tuesday, june 14 2005 @ 03:39 pm cdtcontributed by: semioticaviews: 1567 a quick overview of doing redirects from non-ssl to ssl websites. ed. note: while you should be able to do th......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE