Title: Interactive Programming Using CGIPerl
1Interactive Programming Using CGI/Perl
2Agenda
- Who needs CGI and why?
- How does the web work?
- Static and dynamic web pages
- What will CGI do for me?
- What do I need to start?
- How do I do it?
3Agenda
- Who needs CGI and why?
- How does the web work?
- Static and dynamic web pages
- What will CGI do for me?
- What do I need to start?
- How do I do it?
4Who Needs CGI Anyway?
Students Honors thesis (25 x 14
350) Faculty Need for international
participants Participants unavailable in
quantity Overseas collaboration Specialist
groups
5How does the web work?
The WWW is a distributed system Files are broken
up and moved around in packets Packets take many
different routes Objects (web pages jpg, avi
etc.) are ind. documents E.g., Accessing a
document is like ordering a book from Amazon.
and they send each page in a different envelope,
using different couriers
6How does the web work?
Uses multiple systems - HTTP HyperText Transfer
Protocol TCP/IP Transmission Control Protocol /
Internet Protocol FTP File Transfer Protocol
(client program like WinSCP) HTML Hypertext
Markup Language URL Uniform Resource
Locator Perl script language
7How does the web work?
Uses multiple systems - HTTP HyperText Transfer
Protocol TCP/IP Transmission Control Protocol /
Internet Protocol FTP Client program (like
WinSCP) HTML Hypertext Markup Language URL
Uniform Resource Locator Perl script language
8Static and Dynamic Web Pages
Static pages are 1. Held on a server (OP's Win
NT, UNIX, Apache, Linux) 2. Requested by a
browser (using hyperlink) 3. Server OP packets
file and sends 4. Browser receives file and sends
back information
9Static and Dynamic Web Pages
Static pages architecture
Server
Browser sends request
Server returns document (s)
Browser
10Static and Dynamic Web Pages
Static pages architecture User sees documents
but can't interact with it Experimenter can show
stimuli, but can't collect data
11Static and Dynamic Web Pages
Dynamic pages (2 types) are Either held on a
server (like static pages) but file sent depends
on input from the user/browser Or Pages not
held on server but made "on the fly" by a
computer program
Example 1 Depends on user
12Depends on User Input
Jane Doe
26
Female
Female
Male
http//mysite.com/washingup.html
http//mysite.com/astonmartin.html
13Depends on User Input
ENV IP address Country City ISP Browser Time
Every time you click you send environment
information
IE v7
Firefox
14Static and Dynamic Web Pages
Dynamic pages (2 types) are Held on a server
(like static pages) but sent file depends on
input from the user/browser Or Pages not held
server but made "on the fly" by a computer program
Example 2 On the fly
15(No Transcript)
16Normal web pages end in .html . this ends in
.pl Constructed by a computer program (.pl
Perl), does not exist on server
17Static and Dynamic Web Pages
CGI (Common Gateway Interface) is used to
generate User dependent interactions On the fly
pages CGI is not A programming language
CGI capability on a server will work with nearly
any language
18Static and Dynamic Web Pages
Dynamic pages architecture
Browser requests document e.g form on web page
Server sends complete document
Server
Server rec. CGI request
Perl Program
Program constructs new document or sends specific
one that already exists
19What Will CGI Do For Me?
Tools (objects) can be put on web pages (forms)
20What Will CGI Do For Me?
Tools (objects) that can be put on web pages
(forms) are Text boxes (collect typed info)
Name
21What Will CGI Do For Me?
Tools (objects) that can be put on web pages
(forms) are Text areas (multi line with auto
scroll bars)
Please write acerbic comments here
22What Will CGI Do For Me?
Tools (objects) that can be put on web pages
(forms) are Radio buttons (one choice from X
options)
23What Will CGI Do For Me?
Tools (objects) that can be put on web pages
(forms) are Check boxes (multiple choices from
X options)
24What Will CGI Do For Me?
Tools (objects) that can be put on web pages
(forms) are Submit button (auto submits form
contents to server)
25What Will CGI Do For Me?
Forms are particularly useful for Survey
methods Experimental methods (where RT and ISI is
not critical) Evidence that collecting RT's is
possible (ISI?) Book Birnbaum, M. (2000). Psych
experiments on the Internet. New York Academic
Press
26What Do I Need To Start?
Must have CGI enabled web server Difficult as
CGI poses security and spam risks But Bilkent
will allow it FTP client software to upload web
pages and CGI scripts Win SCP (free) Web
authoring tools to make HTML and Perl files Cute
HTML (free)
27What Do I Need To Start?
Make pages sexier and easier to
construct Decent CSS template for the HTML
files Free from Open Source Web Design
www.oswd.org/ Dreamweaver Web Authoring Er.
known to be "free" around campus ActivePerl from
ActiveState to test Perl scripts Free from
http//www.activestate.com/Products/ActivePerl/
28How Do I Do It?
When you access your Bilkent account using
WinSCP
29How Do I Do It?
When you access your Bilkent account using
WinSCP
30How Do I Do It?
When you access your Bilkent account using
WinSCP
31How Do I Do It?
Dynamic pages architecture
Browser requests document
Server sends complete document
Server
My Perl Programs
My Web Pages
And writes to a file (data collection)
32I Want This! What Now?
1. Ask Bilkent Computing to enable cgi on your
account Make note of cgi URL alias 2. Go to my
website and download Cute HTML Win SCP 3. Go
to the web and download A web page template
using CSS ActivePerl 4. Build static web pages