Date: Wed, 20 Jun 2001 15:16:27 -0500 (CDT) From: Mark Jacobson To: 810-088-05@uni.edu Subject: PERL assignment due tommorrow (Thursday)... Hi Perl students, Your PERL assignment requires you to make two files. One is a web page file, ending with the suffix .html and the other is a Perl script, ending in the suffix .cgi as in Common Gateway Interface. Since this is the 1st assignment, some of you might name these assign1.html and assign1.cgi, but I named mine interest.html and interest.cgi Web page file and Perl script file .html .cgi When your assignment is done, you can print out the .cgi file and hand that in during class on Thursday or Friday. You also mail me the URL to get to the .html file. #!/usr/bin/perl -w # Written by Mark Jacobson (your name) <----- comment line # Due date is June 21st <----- name and due date use CGI ':standard'; etc etc The command at the chaos prompt that I would use to get the printout, would be: enscript -2r -dwrt112 interest.cgi or lpr -Pwrt112 interest.cgi The enscript command formats it in two columns, rotated, which is what the -2r option means. ---------------------------------------------------------------------------- Send email to jacobson@uni.edu or to jacobson@cns.uni.edu like this: Mark My interest calculator assignment is all done. The URL is: http://student.cns.uni.edu/~jeeve002/interest.html or it might be http://student.cns.uni.edu/~jeeve002/cgi-bin/interest.html if you (John Jeeves is the student with user id jeeve002) had written and saved the interest.html web page in the cgi-bin folder, same folder as where the interest.cgi folder is. --------------------------------------------------------------------------- VIP See the class web page at http://www.cns.uni.edu/~jacobson/c088.html and study the 1st two links from that page, especially the long email note review of the cylinder area calculating program we did as both cyl.pl and as cyl.html, with a cyl.cgi Perl script used by cyl.html. ---------------------------------------------------------------------------- First assignment: PERL/CGI Interest Calculator, adapted from the Greg Perry Perl textbook. Here is the working Cylinder Area Calculator from the Friday, June 15th hands-on lab class. Study it to develop the understanding and technique needed for the Interest Calculator. (See c088.html for these 2 links) --------------------------------------------------------------------------- There is a quiz tommorrow (Thursday). Study your lecture notes and the handouts and study over the web page and web site. Especially study over the links about the Interest calculator assignment and the Cylinder Area Calculator, as well as the Lecture #1 review and example HTML, FORM and PERL/CGI script link. The URL for that last link is: http://www.cns.uni.edu/~jacobson/testForm.html You should know the concatenate operator, what interpolation is, what the acronym PERL stands for, etc. How to use the CGI param() function, such as param('radius'), for example. Difference between split and join. How do you do a here file (see page 234 of Elizabeth Castro). Splitting a Value into Pieces (see page 185 of Castro). As far as reading goes, you should have read the following, concentrating mostly on what has been covered in lectures or labs when you come across it in reading these pages/chapters: Greg Perry 24 Hours book: Elizabeth Castro PERL and CGI For The Teach Yourself Perl in 24 Hours World Wide Web ------------------------------- ------------------------------ Hour 1 Chapter 1 Introduction Hour 2 Chapter 2 Perl Building Blocks Hour 3 Chapter 7 Getting Data from Hour 4 (pages 67-71 only) Visitors pages 83-87,93,94 Chapter 9 Getting Data into the Script pages 103-104 ------------------------------------------------------------------------------ Do NOT worry about transliteration operator, which we just introduced today in the hands-on class. $message =~ tr/a-z/b-za/; would tranlate or transliterate and encrypt a message so that it was encoded. $message =~ tr/b-za/a-z/; would translate it back to the original, or decode or decrypt the message again. chaos:~$ perl -e ' $message = "Hello There"; #1 $message =~ tr/a-z/b-za/; #2 (statement #2) print $message . "\n\n"; #3 $message =~ tr/b-za/a-z/; #4 print "$message\n\n"; ' #5 Hfmmp Tifsf <----- Statement #2 output Hello There <----- Statement #4 output ---------------------------------------------------------------------------- Do NOT worry about transliteration operator $str =~ tr/A-Z/a-z/; --- -------------------- The above material can wait till the 2nd quiz, when you have more experience. ---------------------------------------------------------------------------- See you at the quiz. Your program is not due at classtime. You can mail me the URL when its done and turn in the interest.cgi printout on Thursday or Friday in class, or slide it under my office door too. We will review Perl and answer questions BEFORE the quiz on Thursday and have it either in the middle or at the end of class. Mark