Guide To UNIX Using Linux Third Edition

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

Chapter 25 Perl and CGI (Common Gateway Interface)
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 1 Introduction to Perl and CGI.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
A Guide to Unix Using Linux Fourth Edition
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
The Web Warrior Guide to Web Design Technologies
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
CIS101 Introduction to Computing Week 05. Agenda Your questions Exam next week - Excel Introduction to the Internet & HTML Online HTML Resources Using.
Linux+ Guide to Linux Certification, Second Edition
Introduction to HTML 2006 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Introduction to HTML 2006 INT197B. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Introduction to HTML 2004 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
CIS101 Introduction to Computing Week 06. Agenda Your questions Excel Exam during second hour Our status after the snow day Introduction to the Internet.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Chapter 9 Using Perl for CGI Programming. Computation is required to support sophisticated web applications Computation can be done by the server or the.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Guide To UNIX Using Linux Fourth Edition
2 1 Sending Data Using a Hyperlink CGI/Perl Programming By Diane Zak.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
USING PERL FOR CGI PROGRAMMING
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Chapter 8 Introduction to HTML and Applets Fundamentals of Java.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Linux+ Guide to Linux Certification, Third Edition
Chapter Nine Perl and CGI Programming. 2 Objectives Basic features of Perl language Set up an HTML Web page Use Perl and CGI scripts to make your web.
4 Chapter Four Introduction to HTML. 4 Chapter Objectives Learn basic HTML commands Discover how to display graphic image objects in Web pages Create.
Introduction to PHP Advanced Database System Lab no.1.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
3 1 Sending Data Using an Online Form CGI/Perl Programming By Diane Zak.
Introduction to JavaScript CS101 Introduction to Computing.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
Introduction to Programming the WWW I CMSC Winter 2003.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Linux+ Guide to Linux Certification, Second Edition
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Introduction to CGI PROG. CGI stands for Common Gateway Interface. CGI is a standard programming interface to Web servers that gives us a way to make.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Linux Administration Working with the BASH Shell.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
PHP using MySQL Database for Web Development (part II)
Web Database Programming Using PHP
Chapter 6 JavaScript: Introduction to Scripting
Web Database Programming Using PHP
Introduction to Programming the WWW I
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 27 WWW and HTTP.
Guide To UNIX Using Linux Third Edition
WEB PROGRAMMING JavaScript.
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
Web DB Programming: PHP
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
PHP an introduction.
Presentation transcript:

Guide To UNIX Using Linux Third Edition Chapter 9: Perl and CGI Programming Guide To UNIX Using Linux Third Edition

Objectives Understand the basics of the Perl language Identify and use data types in Perl scripts Understand differences between the Awk program and Perl programming Guide to UNIX Using Linux, Third Edition

Objectives (continued) Access disk files in Perl Use Perl to sort information Set up a simple HTML Web page Understand how Perl and CGI are used for creating Web pages Guide to UNIX Using Linux, Third Edition

Introduction to Perl Perl contains features found in other languages – it is very similar to C and also contains features found in Awk and shell programs Guide to UNIX Using Linux, Third Edition

Introduction to Perl (continued) Perl can be directed to read its input from the keyboard Guide to UNIX Using Linux, Third Edition

Introduction to Perl (continued) Perl uses decision structures such as if statements to control program flow Guide to UNIX Using Linux, Third Edition

Introduction to Perl (continued) Guide to UNIX Using Linux, Third Edition

Introduction to Perl (continued) Guide to UNIX Using Linux, Third Edition

Identifying Data Types Data may be represented in Perl in a variety of ways: Variables and constants Scalars Numbers Strings Arrays Hashes Guide to UNIX Using Linux, Third Edition

Variables and Constants Variables and constants are symbolic names that represent values stored in memory The value of a variable can change while the program runs The value of a constant does not change while the program runs Guide to UNIX Using Linux, Third Edition

Scalars Scalars are simple variables that hold a number or a string A string is any nonnumeric sequence of characters (including numbers treated as characters) Scalar variable names begin with a dollar sign ($) Guide to UNIX Using Linux, Third Edition

Numbers Numbers are stored as either signed integers, or as double-precision floating-point values Numeric literals can be either integers or floating-point values Perl uses an added convention with numeric literals to improve legibility: the underscore character (_) Guide to UNIX Using Linux, Third Edition

Strings Sequences of any types of characters Often used for logical analysis, sorts, or searches String literals are usually delimited by either single (‘) or double quotes (“) To put control and escape characters into strings, need to use \ notation, e.g., \n is a newline character Guide to UNIX Using Linux, Third Edition

Strings (continued) Guide to UNIX Using Linux, Third Edition

Strings (continued) The use of special codes determined the output of this Perl script Guide to UNIX Using Linux, Third Edition

Arrays Variables that store an ordered list of scalar values accessed with numeric subscripts An at sign (@) precedes the name of an array when assigning it values Use the dollar sign ($) when processing the individual elements of an array Subscripts are zero-based Guide to UNIX Using Linux, Third Edition

Hashes Variables that represent key/value pairs A percent sign (%) precedes the name of a hash variable when assigning it a value Use the dollar sign ($) to refer to a single element of a hash Guide to UNIX Using Linux, Third Edition

Perl versus the Awk Program This Awk program counts comment lines in a file. Awk doesn’t use while-type statements for looping. Guide to UNIX Using Linux, Third Edition

How Perl Accesses Disk Files Perl uses filehandles to reference files A filehandle is the name for an I/O connection between Perl and the OS Used to open, read, write, and close a file 3 standard filehandles: STDIN, STDOUT, STDERR Guide to UNIX Using Linux, Third Edition

How Perl Accesses Disk Files (continued) Can open a file With an explicit open statement By providing the file name at the command line (storing it in ARGV[0]) Should always check for failure or EOF when opening a file Guide to UNIX Using Linux, Third Edition

How Perl Accesses Disk Files (continued) Perl can access a file by passing the filename on the command line Guide to UNIX Using Linux, Third Edition

Using Perl to Sort Perl has a powerful sort operator Can sort strings or numbers Can sort in ascending or descending order Advanced sorting operations allow you to define your own sorting routine Guide to UNIX Using Linux, Third Edition

Using Perl to Sort Alphanumeric Fields You can sort words in a Perl program into alphabetical order using the sort function Guide to UNIX Using Linux, Third Edition

Using Perl to Sort Numeric Fields You can sort numeric fields in a Perl program by using a sort subroutine Guide to UNIX Using Linux, Third Edition

Setting Up a Web Page Web pages can be created using HTML (Hypertext markup Language) HTML is a format for creating documents with embedded tags Tags give the document special properties when it is viewed in a Web browser Guide to UNIX Using Linux, Third Edition

Setting Up a Web Page (continued) Hyperlinks load another document into the browser when clicked Web pages are published on a web server Apache is a common Web server software Linux has a loopback networking feature Lets you access your own system as if it were an external network Useful for testing Web pages before publishing Guide to UNIX Using Linux, Third Edition

Creating a Simple Web Page Two ways to create HTML documents: Typing the text and desired embedded tags Using a visual HTML editor Two main parts to HTML code Head contains the title, which appears on the top bar of the browser window Body defines what appears in the browser window Guide to UNIX Using Linux, Third Edition

Creating a Simple Web Page (continued) An HTML document viewed in Mozilla Guide to UNIX Using Linux, Third Edition

CGI Overview CGI (Common Gateway Interface) is a protocol, or set of rules, governing how browsers and servers communicate Scripts that send or receive information from a server need to follow the CGI protocol Perl is the most commonly used language for CGI programming Guide to UNIX Using Linux, Third Edition

CGI Overview (continued) Perl scripts are written to get, process, and return information through Web pages (dynamic pages) Main objects in dynamic Web pages are forms that allow you to collect input data from a Web page and send it to a server Guide to UNIX Using Linux, Third Edition

CGI Overview (continued) This Web page contains a form that collects information from a user to submit to a server via CGI Guide to UNIX Using Linux, Third Edition

Chapter Summary Perl is a interpreted scripting language that can be combined with CGI to create interactive Web pages Perl blends features found in C, Awk, and shell programs Perl includes An if-else statement as a decision structure Numeric and string relational operators Arithmetic operators Guide to UNIX Using Linux, Third Edition

Chapter Summary Perl’s data types include numbers, strings, arrays, and hashes Perl and Awk are both good for applications requiring pattern matching Unlike Awk, Perl includes an explicit while looping structure Perl includes a powerful sort feature Guide to UNIX Using Linux, Third Edition

Chapter Summary Web pages are created using Hypertext Markup Language (HTML) An HTML document contains embedded tags that specify document properties and links to other pages CGI is a protocol or set of rules governing how browsers and servers communicate Guide to UNIX Using Linux, Third Edition