Advantages and disadvantages of Perl script invocation

Source: Internet
Author: User
Tags perl script

Perl scripts as a standalone process at run time, invoking another script means creating a child process, which is fundamentally different from a function call, which is a process in which a separate code is executed. This is a special need to pay attention to the premise, the following summarizes the advantages and disadvantages of this mechanism.

Advantages
    1. Parallelism. Processes are independent and concurrent, so when scripts invoke scripts, both scripts can work in parallel, sub-scripts can call sub-scripts, and parallelism can be infinitely expanded and run efficiently.
    2. Compatibility. A single line of command can invoke other scripting languages, even system commands, simple and convenient.
Disadvantages
  1. Special inspection is required to pass parameters. When invoking a script, the incoming parameter is equal to the argument when the command is knocked, and the invoked script does not proactively check that the parameters meet the requirements and needs to be checked separately when writing the script.
  2. There is no return value after invoking the script. One workaround is that the child script prints the information in standard output, and the parent script captures the information in an inverted quotation mark.
  3. Standard error messages for child script output require special handling to be captured by the parent script. The standard error output cannot be captured because the anti-quote syntax captures only sub-script standard output.
  4. Scripts running in the background will not be killed by CTRL + C. If the child script that is called is running in the background & , it will mask the signal to kill the process, and the child script is still running after the parent script is killed.

Advantages and disadvantages of Perl script invocation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.