The CyberGreeting Script—greet.pl

Example 3.2 is the script from Chapter 10. This script will read the information the user submitted, then create a unique file and write the greeting code inside it. Afterwards, the script will return to the sender a confirmation page containing an HTML form. By submitting the form, the sender sends email to the recipient. This email message contains a link to the file greet.pl just created. The file will be ready and waiting when the recipient follows the link in his or her email message.

Setting Up the Script

Unlike the script for Chapter 8, you need to conform to a directory structure in order to use greet.pl. In whatever directory you place greet.pl, the directory must have both read and execution privileges assigned to it. You must also have a directory inside it called greetings/ that has write privileges.

As I mentioned earlier in this chapter, if you’re new to the concept of privileges, note that they control the type of access users have to directories and files. To retrieve basic HTML files, for example, the directory containing the HTML files needs read privileges assigned to it. To execute CGI and other scripts, the directory must have execute privileges assigned to it. To create and modify files in a directory, that directory needs write privileges.

In fact, now might be a good time to consider how your directory structure should look. Let’s assume that you are going to place all the files for this application in your web server’s ...

Get JavaScript Application Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.