Top Banner
Perl Michael U. Ang
33

Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Dec 31, 2015

Download

Documents

Susan Chase
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

PerlMichael U. Ang

Page 2: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

History of Perl

• Perl was introduced in 1987• reason for its creation was that Mr. Wall was unhappy

by the functionality that sed, C, awk and the Bourne Shell offered him. He looked for a language that will combine all of their best features, while having as

few disadvantages

of its own.

Page 3: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Cont… A brief history of Perl

• Perl became especially popular as a language for writing server-side scripts for web-servers.

• But that's not the only use of perl, as it is commonly used for system administration tasks, managing database data, as well as writing GUI applications.

Page 4: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl Influences

Page 5: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

• written by Larry Wall• A GNU product FREE, Open

Source software• Interpreted and not compiled!• 1º used as a scripting language• originally designed for UNIX®, but is

portable to other O/S• stable, cross platform programming

language

Introduction

Page 6: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

What does Perl stand for?

• ‘Perl’ isn’t really an acronym• 2 favorite expansion:

-- Practical Extraction Report Language-- Pathologically Eclectic Rubbish Lister

• It's not PERL or P.E.R.L. • 'Perl' refers to the language• 'perl' to the interpreter that runs the programs

written in Perl

Page 7: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl Mantras

• Make easy things easy; make difficult things possible.

• TIMTOWTDI: There is more than one way to do it.

• DWIM: Do What I Mean

Page 8: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Versions

Version Descriptions Year

Perl 0 was never introduced to the public. Larry Wall only distributed this copy to his “officemates”.

---

Perl 1 released on to usenet's alt.comp.sources on Dec 18, 1987

1987

Perl 2 expanded the regular expression support (Perl 2 introduced Henry Spencer's regular expression package)

1988

Perl 3 introduced the ability to handle binary data (embedded nulls)

1989

Page 9: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Cont… Versions

Version Descriptions Year

Perl 4 introduced the first Camel book.

final Perl4 release, 4.036 in 1993

1991

Perl 5 drastic changes in syntax has been made; backward compatible;

it makes a lot of the old code obsolete.

introduced such things as hard references, modules, objects and lexical scoping

[in other words: introduced everything else, including the ability to introduce everything else]

most up-to-date stable version is 5.8

1994 /

1995

Page 10: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl 6 works in the way for (coming soon) Perl will include many new features not found in perl version 5

---

Version Descriptions Year

Cont… Versions

Page 11: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl Features

• Perl takes the best features from other languages, such as C, awk, sed, sh, and BASIC, among others.

• Perls database integration interface (DBI) supports third-party databases including Oracle, MySQL and others.

• works with HTML, XML, and other mark-up languages.

Page 12: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Cont… Perl Features

• supports Unicode. • supports both procedural and OO programming. • extensible. • The Perl interpreter can be embedded into other

systems.

Page 13: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl & the Web

• Perl is the most popular web programming language due to its text manipulation capabilities and rapid development cycle.

• Perl is widely known as "the duct-tape of the Internet".

• Perl's CGI.pm module, part of Perl's standard distribution, makes handling HTML forms simple.

• Perl can handle encrypted Web data, including e-commerce transactions.

Page 14: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Cont… Perl and the Web

• Perl can be embedded into web servers to speed up processing by as much as 2000%.

• mod_perl allows the Apache web server to embed a Perl interpreter.

• Perl's DBI package makes web-database integration easy.

Page 15: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Sample Programs

Page 16: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

• Perl is interpreted, so no compilation is needed. To use Perl, create a text file that contains the Perl program. It is recommended that you end the filenames of your Perl scripts with ".pl" in order to distinguish them as Perl scripts.

• After you are done, invoke the Perl interpreter with the name of the file you created. Assuming your file is name "myscript.pl", you should type:

The Perl development cycle

# perl myscript.pl

Page 17: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Hello World

Note: Sample programs where made using OpenPerl IDE

Page 18: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

• print -- echo strings and expressions to the screen.

• The "Hello World" program can be written in perl as follows:

• The string is enclosed in double-quotes(" ... ") bec that's how string constants are represented in perl.

• The semi-colon at the end indicates that this is the end of a perl command. Every perl command should be terminated with a semicolon.

The "Hello World" program

print "Hello World";

Page 19: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Another Example

Page 20: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,
Page 21: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Applications written in Perl

Page 22: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Amazon Online Auctions

• allowed for close of auctions and customer feedback

PayPal Shopping Cart Program

• is a CGI program written in Perl 5 and Javascript. • was designed to work directly with PayPal.

Yahoo

Page 23: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

X-Forum bulletin board • is a free bulletin board, written in Perl. • Features: guests posting limitations, reply e-mail

notification for members, and many moderating tools.

Wemail

• a Web-based email program written in Perl. • It checks POP and IMAP and sends via sendmail or

SMTP. • features: custom folders, address book, attachments,

html email, filters, sorting, search, message labeling and more. It requres only CGI.pm.

Page 24: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Url’s and Books

Page 25: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

• http://www.perl.com/-- the mother of all Perl sites (according to the site)

• www.cpan.org or http://www.perl.com/CPAN/

-- CPAN is the Comprehensive Perl Archive Network, a large collection of Perl software, modules and documentation

-- mirrors: http://www.cpan.org/SITES.html and http://mirror.cpan.org/.

• Note that CPAN is also the name of a Perl module, CPAN.pm, which is used to download and install Perl software from the CPAN archive.

Page 26: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

• http://www.pm.org/

-- a loose association of international Perl User Groups.

• http://www.perldoc.com/

-- Perldoc.com

• http://www.perl.org/

Perl.org

Page 27: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

• http://www.perlmonks.com/

-- Perl Monks

• http://use.perl.org/

-- Perl News

Page 28: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

OpenPerl IDE(integrated development environment)

-- an IDE for writing and debugging Perl scripts with any standard Perl distribution under Win95/98/NT/2000/XP.

-- written in Delphi 5 Object Pascal and Perl and it is OpenSource

• http://open-perl-ide.sourceforge.net/

Page 29: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl Ports (Binary Distributions)• http://www.cpan.org/ports/index.html

-- contains listing of available Perl distribution codes for almost all types of operating systems.

Perl Mailing lists• http://lists.cpan.org/

Perl FAQ• http://perlfaq.cpan.org/

Page 30: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Books

• Programming Perl by Larry Wall, Tom Christiansen, Jon Orwant (O'Reilly July 2000)

• Learning Perl byRandal L. Schwartz, Tom Phoenix (O'Reilly, July 2001)

Page 31: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Cont… Books

• PERL How to Program by Deitel and Deitel et.al. (Prentice Hall, February 2001)

• Perl by Example by Ellie Quigley (Prentice Hall PTR, September 2001)

Page 32: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Cont… Books

• Professional Perl Development  by Wainwright et.al. (Wrox Press, April 2001)

• Professional Perl Programming by Wainwright et.al. (Wrox Press, February 2001)

Page 33: Perl Michael U. Ang. History of Perl Perl was introduced in 1987 reason for its creation was that Mr. Wall was unhappy by the functionality that sed,

Perl Purity Test

• http://www.cpan.org/misc/perl.purity.test

-- Just for fun.