Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is Perl? PERL--Practical Extraction and Report Language

Similar presentations


Presentation on theme: "What is Perl? PERL--Practical Extraction and Report Language"— Presentation transcript:

1 What is Perl? PERL--Practical Extraction and Report Language
Created as a way to process large text or files. Create a script that opens one or more files Processes the information Writes out results

2 WWW functionality Communication with web servers through CGI
Perl takes input from a web form channels through the server and “does something with it.”

3 What can it do? Perl can be used quite flexibly to “do something” with user input append to a flat file add it to a database insert it into an message add it to an existing webpage create a new webpage display it in the browser’s window

4 Most impressive! A new webpage can be created “on the fly” in response to user input a thank you message a confirmation page a follow-up query information returned from a database query Web interactivity!

5 Informations in Perl Online documentation on Perl Books on Perl
follow a tutorial hyperlink Books on Perl Learning Perl from O’Reilly & Associates Series on Perl from O’Reilly & Associates

6 Perl Examples I Create a first Perl program, “first.pl”
#!/usr/local/bin/perl print “Hello, World\n”; chmod 755 first.pl ./first.pl

7 Perl Example II Variables and Input Commands
#!/usr/local/bin/perl $name="HAL"; print "Hello there. What is your name?\n"; $you = <STDIN>; chop($you); print "Hello, $you. My name is $name. Welcome to the CGI Class.\n"; There is no type in $variable_name

8 Perl Example III Perl CGI program has to handle HTML !!
#!/usr/local/bin/perl print "Content-type:text/html\n\n"; print "<html><head><title>Test Page</title></head>"; print "<body>"; print "<h2>Hello, world!</h2>"; print "</body></html>"; This handles HTML output only, how about input? --> needs HTML FORM

9 Program vs. Script A program is a complex set of instructions, compiled in an efficient binary format for a given platform. A script is a set of instructions that is not compiled, but is left in plain text format. Needs an interpreter to execute.

10 Alternatives C, Visual Basic ASP(Active Server Page) Java
JavaScript, VBScript Cold Fusion

11 What You Need to Make It Work
A script Perl software A web form A web server

12 Key Elements In the context of a web application, a script is just a series of instructions that tell the computer how to “do something with” the information a user provides. The “do something” is the “action.” Can be simple or elaborate

13 Structure of Perl CGI Script
1. Setup 2. Parse 3. Process the Input 4. Show the results

14 Simple, but Effective Perl is a relatively simple way to handle the output from HTML forms via CGI. Not the most efficient, but is the most commonly used for simple applications that do not get a high volume of user traffic and do not require sophisticated database processing and query.


Download ppt "What is Perl? PERL--Practical Extraction and Report Language"

Similar presentations


Ads by Google