Process Management
------------------------
1. The exec Function
Because Perl is no longer in control once the requested command has started, it doesn't make any sense to have any Perl code following the exec, except for handling the error when the requested command cannot be started
2. The Environment Variables
For example, suppose you wished to run the system's make utility (which typically runs other programs), and you want to use a private directory as the first place to look for commands (including make itself). And let's say that you don't want the IFS environment variable to be set when you run the command, because that might cause make or some subcommand do the wrong thing. Here we go:
$ENV{'PATH'} = "/home/rootbeer/bin:$ENV{'PATH'}";
delete $ENV{'IFS'};
my $make_result = system "make";
3. Using Backquotes to Capture Output
1) Standard error of a backquoted command is inherited from Perl's current standard error output. If the command spits out error messages to standard error, you'll probably see them on the terminal, which could be confusing to the user who hasn't personally invoked the frobnitz command. If you want to capture error messages with standard output, you can use the shell's normal "merge standard error to the current standard output," which is spelled 2>&1 in the normal Unix shell:
my $output_with_errors = `frobnitz -enable 2>&1`;
2) So, stay away from commands that read standard input. If you're not sure whether something reads from standard input, then add a redirection from /dev/null for input, like this:
my $result = `some_questionable_command arg arg argh </dev/null`;
分享到:
相关推荐
NULL 博文链接:https://huanyue.iteye.com/blog/659271
NULL 博文链接:https://huanyue.iteye.com/blog/660896
NULL 博文链接:https://huanyue.iteye.com/blog/663665
NULL 博文链接:https://huanyue.iteye.com/blog/656304
NULL 博文链接:https://huanyue.iteye.com/blog/662795
NULL 博文链接:https://huanyue.iteye.com/blog/668068
TWRP-3.3.0-0517-REDMI_NOTE7-CN-wzsx150-fastboot.7z
CISM学习笔记(原创)
SPI-Interface_AppNote_(UBX-13001919) SPI-Interface_AppNote_(UBX-13001919)
悉尼科大徐亦达老师的概率机器学习视频课件.zip\悉尼科大学徐亦达老师的概率机器学习,徐老师官网可以直接下载,在此为赖的同学们提供便利。
第三题 :在线性回归模型中,对于某个大小为3的批量,标签的预测值和真实值如下表所示:该批量的损失函数的平均值为:答案:解题程序如下错误原因:没有仔细审题,题目问
机器学习笔记
Day01-ES6新特性以及ReactJS入门1. ES6 新特性此部分内容为前端知识,详见《ECMAScript6 基础笔记》在线文档:JavaScript笔
python库。 资源全名:notetool-0.6.14-py3-none-any.whl
小米Note专用recovery TWRP-20190418-3.3.0.0-2022-04-21-virgo
bugreport-Redmi Note 11 Pro+-2023-12-24-155802.zip
bugreport-Redmi Note 11T Pro+-2023-07-21-213639.zip