next up previous
Next: Creating and Running A Up: Beginning CGI Programming in Previous: Writing/Creating Perl Scripts

Running Perl on a Macintosh Computer -- Using MacPerl

MacPerl is a Macintosh application that you will use to:



Further information on Using and Running MacPerl can be obtained from:
The MacPerl application help menu:


Figure: MacPerl Application Help Menu


and also MacPerl Online Primer http://www.unimelb.edu.au/~ssilcot/macperl-primer/home.html
and MacPerl Online Manual http://www.iis.ee.ethz.ch/~neeri/macintosh/perlman/perl_toc.html

Running MacPerl

To run MacPerl simply double click on the MacPerl application Icon in the MacPerl folder. (In the Internet folder on the Maclab hard disk).

Creating and editing files in MacPerl

To Create a file in MacPerl either create a New MacPerl file from the File menu or edit a file from the BBedit Menu in the Menu Menu Bar of the MacPerl Application


Figure: MacPerl Menu Bar

To open an existing file either Open a MacPerl file from the File menu or edit an existing file from the BBedit Menu in the Menu Menu Bar of the MacPerl Application

To edit a file simply type, cut and paste, drag and drop perl text in the files window.

To save your current Perl text files select save file option form File menu of either MacPerl or BBEdit Lite as appropriate.

Standard file naming conventions recommend that you save you file as file_name.pl or file_name.perl so that it is easy to tell which files in your directory should be perl scripts. Some systems use the .pl to recognise perl scripts.

In MacPerl make sure you save file a Plain Text:


Figure: Saving Perl Source in MacPerl

Testing your Perl Syntax

Having written your complete Perl script it is a good idea to check that it works before you send it into the CGI world.

There are two checks that should be performed:

To check for program syntax simply call the Syntax Check Menu item in the Script menu:


Figure: Checking Perl Syntax in MacPerl

There are two forms of checking. You can check the syntax of the current perl file being edited (first.pl above) or the syntax of file on disk.

A MacPerl window appears which either

Running a Perl Script in MacPerl

To run a script syntax simply call the Run Menu item in the Script menu:


Figure: Running a Perl Script in MacPerl

There are two forms of checking. You can run the current perl file being edited (first.pl above) or a file on disk.

The output of the script appear in a MacPerl window:


Figure:Perl Script Output in MacPerl

In the case of the first.pl program we are developing the output is content type header and HTML that is going to be sent to the browser.

If your script requires input then this is a different more complex matter which we leave until later.


next up previous
Next: Creating and Running A Up: Beginning CGI Programming in Previous: Writing/Creating Perl Scripts
Dave Marshall
9/28/2001