Apache WebServer on Mac and The Three P's Primer Tutorial

Apache WebServer on Mac and The Three P's Primer Tutorial

Apache WebServer on Mac and The Three P's Primer Tutorial

Today’s tutorial shows a web scenario that utilizes The Three P’s with a local Apache web server (at HTTP://localhost/) on a Mac laptop (Mac OSX 10.7.5, Apache/2.2.22 (Unix), mod_wsgi/3.3, Python/2.6.7, PHP/5.3.15) opening up its Web Sharing arrangements, building on the previous Perl Form Validation Primer Tutorial. Please note that any additional MAMP local WebServer can live with this arrangement as a separate local webserver on HTTP://localhost:8888/

In our tutorial we use a PHP web page HTML form element to perform a dice guessing game via the use of a Python CGI application using the mod_wsgi.so Apache module which required some installation and configuration, for which the links below are of interest:

In the tutorial here, as for the referenced tutorial, we use Perl code to validate a PHP/HTML form element’s input tag data using regular expressions, as described by Wikipedia below:

In computing, a regular expression (abbreviated regex or regexp) is a sequence of text characters, some of which are understood to be metacharacters with symbolic meaning, and some of which have their literal meaning, that together can automatically identify textual material of a given pattern, or process a number of instances of it that can vary from a precise equality to a very general similarity of the pattern. The pattern sequence itself is an expression that is a statement in a language designed specifically to represent prescribed targets in the most concise and flexible way to direct the automation of text processing of general text files, specific textual forms, or of random input strings. A regular expression patterns a match to a string. It is employed in a search to identify text for further processing, such as displaying the match, or altering it; or it is employed to simply inform of the location or count. The concept arose in the 1950s, when Kleene formalized the description of a regular language, and came into common use with the Unix text processing utilities ed, an editor, and grep (global regular expression print), a filter.

This Perl form validation client-side technique uses a GET method, but if you want to hide your data and use a POST method, you may need to do form validation from the server-side using PHP , for example.

By the way the format of the telephone number asked for by this tutorial is for an Australian telephone number which is a 2 or 3 digit area code followed by an 8 digit number. If you can’t get through maybe you can just listen to a song.

Download PHP source code and rename to validateperlpython.php
Download Perl programming source code and rename to validateperl.cgi
Download Python programming source code and rename to index.wsgi (placed in a pythonplace subdirectory, perhaps)
Download configuration file and rename to .htaccess (for a pythonplace subdirectory, perhaps)
Download Apache configuration file and rename to httpd.conf (is the Apache configuration file for my Mac laptop environment, so yours could be similar but different (please use care))

Regarding the form validation aspects to this topic I really like “Perl and CGI for the World Wide Web” by Elizabeth Castro

In researching the form validation aspects to this tutorial topic found the following two sites very useful … Hidden fields, Online Perl Interpreter and Debugging Tool … so, thanks.


Previous Perl Form Validation Primer Tutorial is shown blow.

Perl Form Validation Primer Tutorial

Perl Form Validation Primer Tutorial

In tutorial here we use Perl code to validate an HTML form element’s input tag data using regular expressions, as described by Wikipedia below:

In computing, a regular expression (abbreviated regex or regexp) is a sequence of text characters, some of which are understood to be metacharacters with symbolic meaning, and some of which have their literal meaning, that together can automatically identify textual material of a given pattern, or process a number of instances of it that can vary from a precise equality to a very general similarity of the pattern. The pattern sequence itself is an expression that is a statement in a language designed specifically to represent prescribed targets in the most concise and flexible way to direct the automation of text processing of general text files, specific textual forms, or of random input strings. A regular expression patterns a match to a string. It is employed in a search to identify text for further processing, such as displaying the match, or altering it; or it is employed to simply inform of the location or count. The concept arose in the 1950s, when Kleene formalized the description of a regular language, and came into common use with the Unix text processing utilities ed, an editor, and grep (global regular expression print), a filter.

This Perl form validation client-side technique uses a GET method, but if you want to hide your data and use a POST method, you may need to do form validation from the server-side using PHP , for example.

By the way the format of the telephone number asked for by this tutorial is for an Australian telephone number which is a 2 or 3 digit area code followed by an 8 digit number. If you can’t get through maybe you can just listen to a song.

Download HTML source code and rename to validatepl.html
Download Perl programming source code and rename to validatepl.cgi

Regarding this topic I really like “Perl and CGI for the World Wide Web” by Elizabeth Castro

In researching this tutorial topic found the following two sites very useful … Hidden fields, Online Perl Interpreter and Debugging Tool … so, thanks.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Software, Tutorials and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>