|
Web Programming with Perl
Info |
Syllabus |
Assignments |
Lecture Notes |
Resources |
Roster
|
Info
|
When | Tuesday/Friday 10:00-11:20am |
Where | Sci 217 |
Faculty | Jim Mahoney
(mahoney@marlboro.edu) |
Credits | 3-4 ( i.e. 9-12 hours/week including class ) |
Level | Intermediate |
Prereq | some experience with web pages, programming, and the command line |
Textbook | CGI Programming with Perl, 2nd edition, Guelich, Gundavaram, and Birznieks |
Website |
|
As you may have heard, the internet is quite
popular these days. Much of the content
you find on the WWW - text, forms, images,
or whatever - is created and managed
by computer programs. In this class you'll
learn how to write those programs, and along
the way look at various internet technologies.
In addition to learning some Perl
(one of the popular languages for doing
internet work), we'll also look at how web
servers and clients work and how to write
programs that create "dynamic content"
for the internet. Our web servers run on unix boxes,
so you can expect to learn some a bit about unix systems as well.
The details of how much we cover and what depth will depend largely
on the background skills of those who take the course.
To take this course you should have some
experience creating web pages with HTML,
as well as some previous programming experience.
You can take this course for either 3 or 4 credits,
depending on your background, skills, and how much
time you want to put in; basically the 4th credit
requires a more thorough approach to the weekly assignments,
a mid-term project, and a much more substantial term project,
totaling an extra 40 hours of work over the semester.
Expect this webpage to continue to change throughout the semester
as assignments and resources are added.
|
|
Tentative Syllabus
Tues/Thur week topic
------------------------------------------------------------------------------
Sep 3 1 intro - editing files, finding perl, and the command line
7, 9 2 "hello world" chap 1 Beginning Perl
14, 16 3 $x, if chap 2 & 4 Beginning Perl
21, 23 4 HTML, HTTP chap 1 & 2 CGI Programming
28, 30 5 first CGI chap 3 CGI Programming
Oct 5, 7 6 @array, %hash chap 3 Beginning Perl mid-term grades
12, 14 7 sub{} chap 8 Beginning Perl
21, 8 HTML forms online Hendrick's days
26, 28 9 url?foo=bar chap 4 CGI Programming
Nov 2, 4 10 use Foo;
9, 11 11 CGI.pm
16, 18 12 files/cookies chap 10 & 11 CGI Programming
23 practice Thanksgiving
29, 2 13 GD.pm graphics chap 13 CGI Programming
Dec 7 14 projects
|
Assignments
- for Tues September 7
- Send me (mahoney@marlboro.edu)
an email telling me you're registering for this class.
- Read chapter 1 of Beginning Perl.
- Browse notes & resources from last year's Perl course here.
- Try to run a "hello world" perl program on either
(a) your own computer, (b) a lab computer, or (c) a remote
shell on akbar.marlboroe.edu or cs.marlboro.edu.
Report on your experience in class on Tuesday.
- for Tues September 14
- Visit and browse around at perlmonks.org.
- Visit and browse around at perldoc.com,
especially the "perlintro" and "perlfaq" parts of the "Perl Manpage".
- Type "perldoc perldoc" at a command prompt. Read what it says,
and browse around.
- Start reading chapters 1, 2, 3, 4, 8, 9 in
Beginning Perl,
which cover scalars, lists, loops, and subroutines. (You can of
course print this stuff out if you don't like reading from a screen.)
Or read similar material from another text.
Try some of the exercises at the end of the chapters to practice.
- Write a perl program that finds and prints all the
prime numbers from 1 to 200.
- Send me an email (mahoney@marlboro.edu) with your work.
- Alternative 1 : For those with perl experience,
read about object oriented programming, either in the tutorials
at perlmonks, or in the perlboot, perltoot, perltooc, perlbot
tutorials in the man pages at perldoc.com, among other places.
Work through some of the examples, and send me a description
of what you did.
- Alternative 2 : Or, install and compile the apache
web server in your cs.marlboro.edu directory. There's plenty
of documentation at apache.org.
I'd suggest version 1.31, although 2.0.50 is OK, too.
After installing, you edit httpd.conf to configure the server,
and then run it on a high port like 8123 or whatever you like.
(Only the root user can run services on low ports.) Point a
browser at http://cs.marlboro.edu:8133/ and see what you get.
- for Tues September 21
- Write a program that counts how many times
each word appears in a large-ish text file.
Hint: use a hash for each word.
- Write a program that implements the game "hangman",
with the user doing the guessing,
picking a random work from the /usr/share/dict/words
dictionary or other substantial word list of your choice.
Details of the user interface are up to you.
Be clear about what testing you've done, and put
in reasonable documentation.
- Time to start talking about CGI.
Read chapters 1 and 2 in CGI Programming in Perl,
and start reading chapter 12 in Beginning Perl.
We'll be talking about the forms and the ENV hash next week,
so please try to figure out how that stuff works.
- In your html/cgi/ directory on cs.marlboro.edu,
create a perl script random_picture.cgi which displays
an HTML page with a embedded image chosen at random
from several in that directory. We'll discuss how
scripts like this get called over the web in class.
- for Tues September 28
- finish reading 4 in CGI programming; start reading 5
- finish reading chapter 12 in Beginning Perl
- Write two versions of a "guestbook" application,
one using the CGI.pm module and one with just the "bare" %ENV hash.
The web script should allow visitors to
record a brief message which will be added to a "web log",
which you save in some sort of file and display on the page.
Depending on
how comfortable you are with all this, you are
encouraged to explore the use a cookie
to remember the user's name, and put up a personalized
greeting when they come back.
- for Tues October 5
- Read chapter 8 in CGI Programming, on Security
- Read the WWW Security FAQ
- Investigate security flaws in the "guestbook" program.
What can it do that it shouldn't?
Are there things that would make it even more problematic?
- Add the ability to send email to your guestbook program.
Turn on "Taint" mode in your guestbook program,
and make sure you do this in a secure way.
- for Tues October 12
- Read the article Preventing Cross-site scripting attacks
. (This is a follow-up to last week's material.) -->
- Read chapter 6 in CGI Programming, on templates.
- Browse Template Toolkit at .
- Check out HTML::Mason, at www.masonhq.com
- Work through Jim's examples in code/template/
- Pick either Template Toolkit or HTML::Mason (or both)
to look at in more detail. Work through some of the examples
in their documentation, and start to set up a collection of web pages
with a common header/footer theme using the template ideas.
If you want to use HTML::Mason you'll have to talk to me
about turning it on in httpd.conf, so check with me first.
I've decided to give two weeks for you to look at
templates - there's a lot of stuff here. This means
though that you should have something substantial
complete by then.
- for Tues October 26
- See lecture_notes/oct21.txt
for sources and details.
- Read a bunch of stuff about SQL
- Draw an ERD for a smallish registrar database which contains
at least this info. Feel free to add other details if you wish.
student course faculty
------- ------ -------
Joe Fish calculus Dr. Who
Joe Fish physics A. Einstein
Mary Green calculus Dr. Who
Mary Green chemistry A. Noble
Ellen White radio Dr. Who
Francis Eld radio Dr. Who
Frank Micklin chemistry A. Noble
- Write a file of MySQL commands that will
i) create the tables for this database, and
ii) populate the tables with this data.
- Now generate some SQL queries that will find out
i) which students are taking physics?
ii) which courses are Dr. Who teaching?
- Try some of the "Assessment" exercises on
http://sqlzoo.net/
- for Tues November 2
- Check out my answers to the last assignment
in code/registrar_db/v1_sql/,
including how to run the mysql stuff and the Perl/DBI version
- Read about the Perl/DBI :
- Review perl objects - see the perlmonk or perldoc tutorials.
- for Tues November 9
- Check out my latest addition to this application we're building
in code/registrar_db/v2_perlDBI/
- Complete the rest of the work that I haven't finished in v2_perlDBI,
or do something similar with a database of your own.
- Read about Class::DBI; follow the links at http://www.class-dbi.com (start with the BeginnersGuide).
- for Tuesday November 16
- one of the crypto assignments; see the lecture notes
- project proposal
- catch up on any outstanding assignments and your webpage of links to 'em
- for Tuesday November 30 - optional
- last weekly assignment. See the Nov 23 lecture notes. Do either one of these :
- Use GD to generate a dynamic picture, or
- Use LWP::Simple and/or HTML::SimpleLinkExtor to fetch and manipulate web pages
- Continue work on your projects
|
Lecture Notes
|
Resources
- Perl books - paper and online
- Programming Perl, third edition,
by Wall, Christiansen, and Orwant
- Learning Perl by Schwartz and Christiansen
- Beginning Perl - online book
- Picking Up Perl - online book
- Links
|
Jim Mahoney
(mahoney@marlboro.edu)
Last modified <% &lastmodified %>
|