Skip to main content

Posts

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`;

Screenshot capture in MacOS

To capture the entire desktop, press Command-Shift-3 . The screen shot will be automatically saved as a PNG file on your desktop. To copy the entire desktop, press Command-Control-Shift-3 . The screen shot will be placed on your clipboard for you to paste into another program. To capture a portion of the desktop, press Command-Shift-4 . A cross-hair cursor will appear and you can click and drag to select the area you wish to capture. When you release the mouse button, the screen shot will be automatically saved as a PNG file on your desktop. (The file is saved as PDF in Mac OS 10.3 and earlier.) To capture a specific application window, press Command-Shift-4 , then press the Spacebar . The cursor will change to a camera, and you can move it around the screen. As you move the cursor over an application window, the window will be highlighted. The entire window does not need to be visible for you to capture it. When you have the cursor over a window you want to capture, jus

Tools for MacOS

OSX Editors: Applications -> TextEdit (set up as a Plain Text Editor ) TextMate (commercial) vim (graphical version, command line version comes with recent OSXs) Padre   OSX Command line terminals: Applications -> Utilities -> Terminal.app iTerm2

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