Skip to main content

Posts

Showing posts with the label Perl

Perl command to execute a system shell command

exec(PROGRAM); $result = system(PROGRAM);    Both Perl's exec() function and system() function execute a system shell command. The big difference is that system() creates a fork process and waits to see if the command succeeds or fails - returning a value. exec() does not return anything, it simply executes the command. Neither of these commands should be used to capture the output of a system call. If your goal is to capture output, you should use the backtick operator:   $result = `PROGRAM`;

Beginners Guide for CGI scripts

This tutorial has been developed to help you get your CGI script working. It focuses on common problems associated with setting up CGI scripts. There are some links to other helpful resources at the end. You should check these out if you cannot find the answers you need here. What follows is a sort of checklist to help you solve the problem quickly yourself. It is divided into four parts: Before uploading to the Server Uploading to the Server Setting Up on the Server Debugging a. Before Uploading to the Server 1. Does your script compile? Like any Perl program, a CGI script needs to compile successfully before it will run. Until it does this you can forget everything else. To test this you need a command prompt and a working Perl interpreter. For information on how to build a Perl interpreter or to get a pre-built Perl for your platform, Installing and Adding to Perl on PerlMonks. Once you have a perl you can access from a command prompt, type: perl -c myscript.pl