in a compilation. The steps for installing a Perl module
Perl modules that you can download and install to
packaged as a tar.gz file are as follows:
increase the sophistication of your Perl scripts. Each Perl
module contains a number of routines that are relevant to a
particular type of processing. For example, the CGI module
tar xf <module-name.tar>
reduces the code that you must produce to create CGI
scripts. Most modules are free, and you can modify them, if
needed, to suit your application. Modules are contributed
by their authors who consider them useful enough to be
generally valuable. If you are now or become a proficient
Perl programmer, you might consider contributing modules
that you develop to the Perl community. Some Perl modules will require other modules to be installed
before they can be used. When a module that you are trying
You may sometime acquire a Perl modules in the form of a
to install has a prerequisite, you will get a message when you
gzipped TAR file. When this is the case, the process of
type the perl Makefile.PL command.
installing looks much like the process of compiling open
INSTALL PERL MODULES (CONTINUED)
Download Link to Disk
в– The Save dialog box
ГЃ Select Download Link to вЂЎ Click the Save button after
appears. verifying your save location.
WORK WITH PERL
If you are interested in the format
A pragma is a special Perl module that comes with your
and other technical details of how
installation of Perl. If you have tried the use strict;
Perl modules are organized, the Perl
command, you have already used one of these special modules.
mod man page will provide you with
You can learn more about the pragmas that are included in your
many insights. In a Terminal window,
release of Perl with the command man perlmodlib.
type man perlmod and press Return.
Perl has a search path that it uses to look for modules. You
can view this by issuing the perl вЂ“e 'print "@INC"'
command as shown here.
TYPE THIS: RESULT:
[ferro:˜] user% perl -e /System/Library/Perl/darwin
'print "@INC"' /System/Library/Perl
в– The download manager В° In a Terminal window, В· Press Return.
downloads your module. type sudo cp Telnet.pm
вЂљ Enter your password if
or copy your Perl module
to the proper location in
the name of the module
to determine if the library
belongs in a directory.
UNIX FOR MAC
WRITE A CGI SCRIPT
The CGI module uses functions to generate HTML code.
ou can write a CGI script to create a Web page that
These include header and start_html вЂ” functions that
interacts with your visitors. While the term CGI
create the HTML header вЂ” and tags such as <html> and
identifies a class of script that allows Web pages to
<body>, which you need to format an HTML page.
interact with the system on which the script is running,
most scripts are written in Perl. This is because the
Other functions include h1, hr, and end_html. As you see,
versatility of Perl makes it a good language to use on the
these commands resemble HTML codes. A command such
Web. The basic function of a CGI script is to perform a
as print h1("My Life in 50 Words or Less");
process and then to prepare the output in HTML format so
takes the place of a print command containing the
that it can display in a Web page.
beginning and ending tags for heading level 1 text.
To use the CGI module that installs on your system, you can
You can use CGI scripts to build pages that contain dynamic
use the Perl command use CGI;. This command loads the
text, because you can use Perl commands to gather
CGI module into your script. For most CGI scripts, you
information from the system or vary the contents of the
amend this command by specifying that you want to use
page in other ways. You can also build CGI scripts that
the most command functions. The altered use command
create a form allowing the user to enter text, and then
then becomes use CGI qw(:standard);. This allows
process that text.
you to access HTML, form generation, and CGI functions.
WRITE A CGI SCRIPT
вЃ„ In the Pico text editor, вЂ№ Type print header; and Л‡ Type print h1("This is a вЂЎ Type print end_html;.
type #!/usr/bin/perl вЂ“w and press Return. CGI"); and press Return.
В° Save your file as testcgi.pl,
press Return twice.
вЂє Type print start_html("this ГЃ Type print hr; and press and exit the editor.
В¤ Type use CGI is a test"); and press Return Return twice.
qw(:standard); and press twice.
WORK WITH PERL
To create a Web form with CGI, you can use commands that create form elements
such as text fields. While you can create these elements without the assistance of
the CGI module, the CGI commands simplify the work considerably. For example,
to create a text field into which a user types information, you can use a command
such as print textfield('comment','Enter your comment',70,80);.
This command creates a text field, displays the phrase "Enter your comment" in
the text field, and sizes the field to 70 text characters. You can add a submit
button with a command such as print submit("submit comment");. What
happens next depends on the remainder of your code. When you run this script,
it submits the comments to a process called process_comments.pl.
use CGI qw(:standard);
print h1("We want your comments");
print textfield('comment','Enter your comment here',70,80);
в– The CGI runs, creating a
В· Type chmod a+x testcgi.pl вЂ” Enter your password if В± In the URL field of a
and press Return. prompted. browser, enter http://localhost Web page containing system
/cgi-bin/testcgi.pl and press information.
вЂљ Type sudo cp testcgi.pl Return.
press Return, replacing
/sw/apache/cgi-bin with the
correct path to your cgi-bin
directory if different.
UNIX FOR MAC
INTRODUCTION TO THE X WINDOW SYSTEM
In addition, if you install X Windows on your Mac OS X
ou can install and use the X Window System to
system, you can take advantage of numerous tools that
enhance the capabilities of your Mac OS X system.
were specifically built to work on the system. X is a
The X Window system is a windowing system that
windowing system that works through the cooperation of
facilitates the sharing of windows on a network. For
separate components. The native windowing system on
example, you can run an application on one system and
Mac OS X is called Aqua.
send the display of that application to another system.
FULL SCREEN VERSUS ROOTLESS
The X Window System, often referred to simply as X The second is called rootless mode. In rootless mode,
Windows or X, can be run in one of two modes. The the X windows live side by side with your Aqua tools
first is full-screen mode. In full-screen mode, the X rather than taking over the screen.
window server takes over your desktop, replacing Aqua.
WHICH X IS WHICH?
There are several versions of X Windows that you can run Window System implementation called XTools available
on Mac OS X. XDarwin is a port of the XFree86 software from Tenon. All X servers perform the same function and
and is free. You can also get an X11 implementation from support the X protocol. Given the significant efforts,
Apple that is also based on XFree86 and is a relative installing an X server on your Mac OS X system should
newcomer to the X scene. There is a commercial X not be difficult.
SERVERS AND CLIENTS
In the world of X Windows, the terms server and client system and generally provide a suite of integrated tools
take on new meanings. The X server is your display вЂ” and applications.
the screen in front of you that you can think of as
Many Unix desktop environments support X Windows
serving you windows вЂ” and the environment in which
natively. This is true, for example, of the common
your X applications run. The X client is any application
desktop environment (CDE) run on Solaris, and
that produces output for the server to display. Another
GNOME and KDE on Linux systems. Aqua does not
important player in the world of X Windows is the
provide support for X Windows without add-on
window manager. A window manager, such as twm or
software such as XFree86 any more than Microsoft
Enlightenment, adds a layer of control to your desktop
Windows does. For these systems, you may acquire
and stylistic elements to your windows. Desktops
and install X server software separately.
attempt to provide a more complete interface to the
RUN THE X WINDOW SYSTEM