Laboratory Week 11 - Server-side Scripting with Perl/CGI
Learning Objectives:
- Learn about basic similarities and differences between Perl/CGI scripting and PHP.
Before doing the tutorial, please read:
- Week 9 lecture 1 on Web Server-side Scripting.
- Review what you learnt in previous labs regarding creating, modifying and uploading PHP scripts to phoenix.
Software required:
- This lab also requires a graphical web browser (like Netscape Navigator or Microsoft Internet Explorer).
Instructions:
The purpose of this lab is to get you to appreciate the similarities and differences between what you have learn about web server-side scripting using PHP, and the equivalent scripting in Perl/CGI. You should find that most of the web communication mechanisms are exactly the same. The one major difference is the syntax of the scripts.
- Access the week 5 introductory lecture on web server-side scripting with Perl/CGI [PDF] [PPT] used in this unit in 2001. Read the code as given in the notes. All line starting with "#" are comments. The actually working scripts are also available at the URLs as indicated in the notes. Use a browser to try them out.
- Compare the Perl/CGI scripts with the PHP versions given in week 5's lectures on PHP this year. Note the main difference: PHP scripts are predominantly HTML pages with a few PHP script tags, while Perl/CGI scripts are Perl code that prints HTML.
Discuss further with your tutor the differences between Perl/CGI and PHP.
- You may create and use the above Perl/CGI scripts the same way as you created your PHP scripts (as instructed in week 7's lab). The only differences are:
- The scripts must have file extension .cgi instead of .php.
- The scripts must exist in a directory called cgi-bin in your public_html directory.
- The scripts must have execute permission. Set this by using "chmod 755 file.cgi", where "file.cgi" is the name of your Perl/CGI file.
Further Reading:
If you are interested in learning to program using Perl/CGI fully, your textbook chapters 8-11 contains step-by-step instructions on how to do so.
Remember to read the week's development on the Internet by scanning through relevant articles in the IT section of Tuesday's the Australian newspaper - use the online version or the physical copy in the University library. Get into the habit of keeping up with current developments. Test your knowledge of major developments by going through the Good News Week self-tests.
H.L. Hiew
Unit Coordinator
Document author: H.L. Hiew,
Unit Coordinator
Last Modified:
Saturday, 19-Oct-2002 22:19:00 MST
Disclaimer & Copyright
Notice © 2002 Murdoch University