533557686 -1- CGI/Perl The lecture notes contained in this packet are based on PERL - How To Program by Deitel. These notes should only be used in the class room in conjunction with the author’s book. The only purpose of these notes is to extract the important topics that will be covered in the CGI/Perl class. The notes are used simply as an outline of the material that will be covered in the class. 533557686 -2Chapter 1 Introduction Computer organization, Evolution of Operating Systems, Personal Computing, Distributed Computing and Client/Server Computing Client server computing - users work on workstations - Information is shared over the network - file servers ( computers) store programs and data that may be used by client computers distributed across a network Structured Programming --- > Object Oriented Programming History of the Internet and the World Wide Web From: ArpaNet ( Advanced Research Project Agency ) network using TCP/IP protocol TCP – Transmission control Protocol ( to route messages properly from sender to receiver) IP – Interconnecting Protocol ( to get the variety of computers to communicate) TO: commercial use The World Wide Web – allows computer users to locate and view, over the Internet, multimedia-based documents ( Developed in 1990 by Tim Berners-Lee of CERN ( the European Laboratory for Particle Physics) The Internet mixes computing and communications technologies. Today’s applications can be written to communicate among the world’s hundred of millions of computers. 533557686 -3- Perl with the Common Gateway Interface (CGI) History: In 1986, Larry Wall ( system programmer for National Security Agency project) invented a new language aimed to integrate features of the UNIX languages such as awk ( a report generating language) and sed ( stream editor) with the shell ( UNIX command-line scripting language). He wanted the language to be easy to use – but at the same time to be powerful. - Perl, the Practical Extraction and Report Language, grew from a text-processing language to a powerful general purpose programming language mostly used for system administration Perl – a flexible, portable and efficient language Perl 3 – adopted the GNU General Public License Perl 4 adopted an Artistic License to attract more users. Both protect Perl’s free open source nature Perl 5 – reorganized in a major way to fix shortcomings Perl is particularly effective with CGI - Common Gateway Interface protocol – - ideal for the WWW – allows users of the internet to connect to web servers which can then interact with other applications and pass their output to client applications in the form of dynamic content. The event of CGI – transformed Perl from a systems administration tool to the most widely used - Server Side Internet Programming Language HTTP Protocol CGI Protocol CGI/script Browser (User’s computer) Web server stores HTML documents Data Bases and other files 533557686 -4- Perl Library – Perl is a modularly extensible language, - many different modules ( reusable pieces of software) have been written by Perl developers around the world. Perl modules are defined in library files ending in .pm Comprehensive Perl Archive Network (CPAN) ww.cpan.org is the distribution center for Perl source code. Users of ActivePerl and implementation of Perl for Windows created by ActiveState Tool Corporation – can use Perl Package Manager (PPM) to find the install procedures. Dynamic and static Web pages – A static web page is an HTML document stored on the local machine or the server A dynamic web page is an HTML document that can control the display of elements in a Web page. Scripts (code) are included in the Web page and executed by the Web browser. Scripts can be written in various languages ( VB script, Java Script, AppleScript, Unix shell scripts, Perl scripts … CGI describes the set of protocols through which applications , i.e. CGI programs or CGI scripts interact with Web servers and with clients ( Web browser).