• No results found

INT322. By the end of this week you will: (1)understand the interaction between a browser, web server, web script, interpreter, and database server.

N/A
N/A
Protected

Academic year: 2021

Share "INT322. By the end of this week you will: (1)understand the interaction between a browser, web server, web script, interpreter, and database server."

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

INT322

Monday, January 19, 2004

Objective

By the end of this week you will:

(1)understand the interaction between a browser, web server,

web script, interpreter, and database server.

(2) know what Perl is and why it is used on the web.

Today

Announcements From Last Week...

Browser Interactions Quiz

Announcements

See me for your account if you don’t have one yet.

Exercise 1 due Friday, January 23 Post a message on Blackboard Edit your Zenit homepage

Attending the other section of the course...

Web Sites: Reminder

Blackboard - Marks, Discussion http://my.senecacollege.ca/

INT322 Web Site

http://cs.senecac.on.ca/~int322/

Web Sites: Reminder

Instructor’s Home Page

http://cs.senecac.on.ca/~ctyler/

Instructor’s Zenit Home Page

http://zenit.senecac.on.ca/~tyler/

Building on Last Session...

bash script

interpreter

Pathnames

Review...

Absolute Relative

Relative-to-home

(2)

Namespace Mapping

Web pathnames vs. file pathnames Translation of namespaces

Not necessarily 1:1

Web Interactions - Static

Browser -> Apache

Apache <-> Filesystem

Apache -> Browser

Web Interactions - Static

Browser -> Apache http(+content)

Apache <-> Filesystem

Apache -> Browser http+content

Web Interactions - Dynamic

Browser -> Apache http(+content) Apache <-> Filesystem

Apache -> OS exec() CGI(+content) OS exec() -> Interpreter

Interpreter -> Script

Script -> Apache CGI+http+content Apache -> Browser http+content

Web Interactions - HTTP Header Format

HTTP Headers are based on ...

?

Web Interactions - HTTP Header Format

HTTP Headers are based on ...

RFC822 (E-mail)

Method/status Header1: value Header2: value blank line Body of message

Web Interactions - Request Headers (Browser)

GET / HTTP/1.1

Host: zenit.senecac.on.ca blank line

Web Interactions - Response Headers (Server)

HTTP/1.1 200 OK

Date: Mon, 09 Sep 2002 14:49:09 GMT Connection: close

Content-Length: 1761 Content-Type: text/html blank line <xml ...

(3)

MIME-Types

MIME

MIME stands for ...?

MIME-Types

MIME

Multimedia Intenet Mail Extensions Format of the content type header?

MIME-Types

MIME

Multimedia Intenet Mail Extensions Content-type: type/subtype

Common MIME-Types

Raw text:

Common MIME-Types

Raw text: text/plain xhtml:

Common MIME-Types

Raw text: text/plain xhtml: text/html PNG graphic:

Common MIME-Types

Raw text: text/plain xhtml: text/html

PNG graphic: image/png Ogg Vorbis song:

Common MIME-Types

Raw text: text/plain xhtml: text/html

PNG graphic: image/png Ogg Vorbis song: audio/ogg MPEG film:

(4)

Common MIME-Types

Raw text: text/plain xhtml: text/html

PNG graphic: image/png Ogg Vorbis song: audio/ogg MPEG film: video/mpeg

CGI

CGI Stands for?

CGI

Common Gateway Interface

CGI Defines... ?

CGI

Common Gateway Interface

Defines server <-> script interaction How many paths?

CGI

Common Gateway Interface

Defines server <-> script interaction 4 paths (2 each direction)

What are the paths?

CGI

Common Gateway Interface

Defines server <-> script interaction 4 paths (2 each direction)

stdin stdout stderr

environment variables

Stdin, Stdout, Stderr

Stdin

’post’ form element values from browser via Apache

Stdout

headers, content to browser via Apache

Stdin, Stdout, Stderr

Stderr

error message

to logfiles via Apache (usually)

Environment Variables client and server details query-string value from URI

(5)

Basic CGI Program Requirements

1. Must be executable by ?

Basic CGI Program Requirements

1. Must be executable by the web server.

2. Must output ?

Basic CGI Program Requirements

1. Must be executable by the web server.

2. Must output at least one header followed by a blank line (usually the Content-type header).

3. Must finish executing before ?

Basic CGI Program Requirements

1. Must be executable by the web server.

2. Must output at least one header followed by a blank line (usually the Content-type header).

3. Must finish executing before anything is sent.

A Word on Web Design & CGI

Many sites have good programming or good design.

The two are not mutually exclusive!

A Word on Web Design & CGI

A good E-Commerce site should have:

Consistent navigation

Feedback on WHERE you are Location in the process

Colour & graphical mode cues

Quiz!

What is Perl?

Perl is an acronym for "Practical Extraction and Report Language".

started out as a scripting language to supplement rn, the USENET reader

created by Larry Wall.

(6)

What is Perl?

Perl:

is an interpreted language

is optimized for string manipulation, I/O and system tasks.

has built-in functions for almost all Unix system commands.

Perl History: 1987

Larry Wall posted Perl 1.0 to the usenet group comp.sources.

Perl History: 1988

Perl 2.0 is released with more text processing enhancements.

The open source community works on creating many modular extensions.

Perl History: 1989

Perl 3.0 is released under the GNU General Public License.

Perl History: 1990

Tom Christiansen’s The Answer to All Man’s Problems is published.

Perl History: 1991

Programming Perl, by Larry Wall and Randal L. Schwartz, is published by O’Reilly & Associates (the Camel)

Perl 4.0 is released under the GPL and the new Perl Artistic License.

Perl History: 1992

MacPerl is released (non-Mac interface).

Perl History: 1993

Final version of Perl 4 released.

MacPerl 4.1.0 has true Mac interface.

Perl community picks up steam -- mailing lists.

Learning Perl by Randal L. Schwartz is published.

(7)

Perl History: 1994

Perl 5 is born.

Perl 5 was a major reorganization that fixed may of the language’s limitations.

Tim Bunce introduces DBI/DBD.

Perl History: 1995

First recorded Perl CGI script.

Work on CPAN begins in earnest.

Perl History: 1996

The Perl Institute (TPI), a not-for-profit perl advocacy organization, is created.

The Perl Journal publishes its first issue.

Perl History: 1997

The Perl Institute announces a web-accessible mirror of CPAN.

Perl History: 1998

Perl Mongers is incorporated as a not-for-profit in New York state.

CPAN grows to 100 mirror sites.

Perl History: 1999

ActiveState Tool Corp. announces a corporate support package for Perl called PerlDirect.

Perl’s usage in developing web applications grows.

Perl History: 2000

Perl 5.6 is released for Windows, Solaris and Linux with Unicode support.

Version number: <major>.<minor>.<path>

Work on Perl 6 begins.

Perl 6 is a major rewrite

Separates compiler from runtime (Parrot)

Perl History: 2001

Perl 5.6.1 is released.

(8)

Perl History: 2002

Perl 5.8 released with strong Unicode support.

Work on Perl 6 continues.

Why Perl for web development?

CGI (the Common Gateway Interface) and Perl.

Perl is rapidly developing.

Text processing strength good match for web.

Why Perl for web development?

Free language, many online resources.

Interpreted - fast debug cycle.

Why Perl for web development?

Integrates well with Internet protocols.

Extensible using modules.

Links

http://www.perl.org/

http://www.perl.com/

http://www.cpan.org/

http://www.opensource.org/licenses/

Demonstration...

Is Perl Installed?

Is Perl installed?

What is the path?

Needed for #!

What Version is Installed?

Current version is 5.6.1 -v argument reports version

-V gives installation details

Getting and Installing Perl: Availability

Available under GPL and/or Artistic License.

Standard in RedHat, Slackware and SuSE.

Downloadable as source & binary.

(9)

Common Download Sites

http://www.perl.com/

http://www.cpan.org/

Acquiring and installing Perl

Use vendor distribution first.

Otherwise use perl.com/cpan.org source or binaries.

Installing from Source

gunzip stable.tar.gz tar xvzf stable.tar

follow README and INSTALL files

Install from Source

./Configure make make test

make install (as root)

Installing from Binaries

RPMs:

rpm -i ActivePerl-5.6.1.631-i686-linux.rpm

Modules

A module is a collection of functions.

Several included in core distribution.

Modules

Three types:

Pragmatic

Library

Object

Installing Modules

Obtain from CPAN

gunzip yourmodule.tar.gz tar xvf yourmodule.tar perl Makefile.PL make

make test make install

(10)

Automated Install

perl -MCPAN -e shell

get make test install readme

References

Related documents

Circle, San Francisco, CA 94124. The purpose of the meetings is to receive comments on the scope and content of the environmental review to be conducted on the proposed

– Sponsor, Regulators, Participants (represented by fiduciaries), Actuary, Trustee, Investment Advisor (for Plan assets), Investment Advisor, or Broker (for annuity purchase),

Safety of percutaneous ultrasound-guided fine-needle aspiration of adrenal lesions in dogs: Perception of the procedure by radiologists and presentation of

framework of financial management; secondly recommendations relating to funding outside the formula, including funding for initiatives, central services and allocated to schools

While the concept has previously been applied to literary history and genre theory, the present study breaks new ground in leaving behind the authorial biography,

The likelihood of receiving skilled antenatal care, postnatal care, having four or more antenatal care visits and having institutional delivery was higher for women who lived

An important quantity characterizing different random graphs is their connectivity or average degree γ , which measures the average number of neighbours that the nodes have.. One of

Figure 1.6 shows the axial pressures for the extruders described in Examples 2 and 3. In this figure, the solid lines were calculated while the dotted lines were estimated based